C
cheezy_squeezy
Guest
Hi all, basically just making some enemy AI that goes to the player's last known position after they have broken line of sight behind a wall (top down game).
It all works fine apart from the enemy not stopping after it has started walking past the player's last known location. I thought this check would work (let playerx and playery be the co-ordinates for their last known location):
if point_distance(xprevious, yprevious, playerx, playery) < point_distance(x, y, playerx, playery) (stop);
My thought process is that when the enemy starts increasing its distance from the coordinates rather than decreasing it (moving away from it) it would stop, but it doesn't seem to have an effect. Am I misunderstanding something here? Cheers.
It all works fine apart from the enemy not stopping after it has started walking past the player's last known location. I thought this check would work (let playerx and playery be the co-ordinates for their last known location):
if point_distance(xprevious, yprevious, playerx, playery) < point_distance(x, y, playerx, playery) (stop);
My thought process is that when the enemy starts increasing its distance from the coordinates rather than decreasing it (moving away from it) it would stop, but it doesn't seem to have an effect. Am I misunderstanding something here? Cheers.