Enemy won't stop when player has retreated

Hi. New to GDevelop and am trying to get a basic function for the enemy to attack when the player is within range. This has worked using the Distance Between Two Objects function but when the player moves away again, the enemy does not revert back to the Idle animation and continues attacking. How do I get it to return back to the idle phase?

You are using distance between 2 objects to check if its below something to go into attack animation

So use same condition but right click it and invert it to check if distance is ABOVE same number and then you set animation to idle

Of course! Thank you so much!

Switched out the check on the animation finishing for the inverted distance and it works perfectly.

1 Like