Problem playing the whole animation

Hello, I am currently working on a platform shooter. My characters are grouped into PlayerSkins. My problem is I can’t seem to make the animations for 17, 18, or 16 play. It just plays the first frame of these animations and then jumps back to frame 0 or 15 respectively. Any Help would be greatly appreciated! I’ve attached the code. Thanks

All events are processed every frame. Because of this, animation events must always use “Trigger once” as a condition, or else every frame you’re resetting the animation.

Thank you for your reply. I have tried that to no avail, maybe I am placing the ‘Trigger Once’ condition in the wrong spot? If I place it where ‘Key is Pressed’ it does nothing, and if I place it where ‘PlayerHitBox is moving’ it breaks it. Where would you suggest I add that condition?

It literally has to be in every event that has an action of “change the animation”.

Additionally, you have numerous conflicts in your events, and they will override each other.

Your player can both be not moving, AND not moving while pressing the X key, AND not moving while pressing the Z key, etc.

You cannot have animation conflicts like this else they will constantly overlap and the engine will freeze the animation as it doesn’t know which to play.

You’re going to need to rework most of your events to either:

  1. make it so they don’t occur when other actions could occur (e.g. “Z key is pressed (inverted)” in your “X key is pressed” event, and vice versa, and separate them from the “Not moving” event, which has to ALSO have a “Z key is pressed (inverted)” and “X key is pressed (inverted)” in it.)
    or
  2. Build a finite state machine so that each state can only occur once and cannot override other states. This is a much more complex option but will lead you to less conflicts/events down the road. You can see examples of this in the “Not-a-vania” example, or a slightly different take here: How to handle complex logic – The finite state machine (FSM) [GDevelop wiki]
1 Like

This is the single most helpful advise I could have got, Thank you for your explanation. I will be trying both ways (I just want to learn option 1 so this doesn’t happen again), but option 2 sounds like the way to go, as I am in the early stages of development. Thank you again for all of your help, I will keep you apprised.

1 Like

UPDATE: Thanks to Silver-Streak I was able to get this to work with option 1! I will now be moving on to option 2. Thanks!

1 Like

UPDATE 2: After several very frustrating hours, I was able to get my finite state machine (option 2) up and running. This seams like the way to go. After the initial build, you have many more options with much less tinkering. My hope is that this will make my game run smoother with less bugs.