How do I stop enemies from moving?

I created an enemy (with platformer behaviour) that detects if the player is in front of it using raycast. If the character is in front, it will go to the “windup” animation and eventually roll forward.

Problem is that sometimes instead of stopping when it is in “windup”, it slowly moves towards the player for a few seconds before winding and rolling.

How can I make it stop moving when it is in windup animation?

A few things:

  1. you aren’t stopping forces when the animation is wind-up.
  2. you don’t have a trigger once on the events, leading to the actions being repeatedly called (including the wait commands, which will be queueing up)
  3. I would recommend you do away with the wait actions as you have them, and work out another way to achieve the same result. Like with object timers.
1 Like