Top-down enemie animation

Hello guys.

I don’t know how to correctly set the 4 enemy animations (down, Up, Left and Right). Can someone explain?

Adds a picture like I tried to do, the animation works as long as there is only y, when I add x it stops working

  1. Don’t repeat for each zombie 4 times. It’s inefficient.
  2. Don’t use the “& if all” (logical AND) condition unless needed. All conditions are needed to be true is an event is triggered.

Your issue is because if you set the animation based on Y position first, then based on X position, the X position animation change will overwrite the Y position animation change.

Instead, you can check which of the X or & position difference is the smallest, and change animation in that direction. Something like:

(here abs stands from absolute value, which removes any negative/minus sign from a number)

1 Like

@MrMen thanks mate :slight_smile: