Y
YuriNikolai
Guest
Hello, i'm sorry for this silly question but i have just begun studying GMS2 and don't know much about it yet. I am using the following code on a Step event to get enemies to chase the player if he gets too close to them:
if (instance_exists(obj_player) && distance_to_object(obj_player) <400)
{
move_towards_point(obj_player.x,obj_player.y,spd)
}
However, whenever the player leaves that range, the enemies stop chasing him. This is one example of an issue i've been having on many areas: I need a Step detection to trigger an event, but how can i get it to continue playing even if the conditions stop being true?
if (instance_exists(obj_player) && distance_to_object(obj_player) <400)
{
move_towards_point(obj_player.x,obj_player.y,spd)
}
However, whenever the player leaves that range, the enemies stop chasing him. This is one example of an issue i've been having on many areas: I need a Step detection to trigger an event, but how can i get it to continue playing even if the conditions stop being true?