C
Chatterb0x
Guest
Hey GM community,
Ever played Kung Fury: Street Rage? My aim is to code a similar enemy targeting mechanic for a mobile app.
The player swipes left or right to attack. If the player swipes right, I want the player object to interact with (kill) nearest enemy instance to player in that direction.
How can this be accomplished?
Thanks
Ever played Kung Fury: Street Rage? My aim is to code a similar enemy targeting mechanic for a mobile app.
The player swipes left or right to attack. If the player swipes right, I want the player object to interact with (kill) nearest enemy instance to player in that direction.
How can this be accomplished?
- instance_nearest() returns instance closest, not necessarily in the direction chosen.
- (instance_nearest() && obj_enemy.x > x) has similar flaw. The nearest object may fulfill one condition, but not necessarily both.
- collision_line() looks promising. According to documentation, it
Checks whether any instances of a given object collide with a given line, and if there is it returns the id of one of those instances.
Does that mean it returns the id of the instance nearest? If so, great!
Or, does it return the ids of all instances on line? That's a little messy.
Thanks