How to Set Up a Multi-State Player Animation System in GDevelop 5?

I’m trying to create a multiple animation system for the player, but I’m not sure what the best approach is. In particular, I need to handle these states:

  • idle
  • moving
  • idle + shooting
  • moving + shooting
  • throwing a grenade while idle
  • throwing a grenade while moving
  • animation when touching / pressing a button

In your opinion, what is the cleanest and most efficient method to manage this?
Is it better to use state variables, booleans, a finite state machine, or to manage everything directly through event conditions?

If you have examples, screenshots of events, or even just some practical advice, it would be really helpful :pray:
Thanks a lot in advance!

My go to with these things is a finite state machine. In the example below, the guard’s state is stored in an object variable Action, and the expanded events show the transition from when the player has been spotted (falls in the line of sight of a guard) to chasing the player, and checking for the player when the guard has reached the position they spotted the player at:




And here’s how that plays out:

Spotted

1 Like

Hi, thank you for your reply. I wanted to know how to create an animation system similar to the one used in the game Metal Slug.

No duplicate threads please.

As this belongs in the how do I section, closing this out as you have a duplicate thread for this in the correct subforum already here: How to Set Up a Multi-State Player Animation System Gdevelop5? - #3 by petlimpet