I’m going to show you how to made a simple state machine in GDevelop 5

First grab the assets here

So lets start

Create a Scene and add all the assets, then create 4 text objects for debug purpose.

The Events of the GameScene

Create an Externa events and name it PlayerEvents and place this code

Continue inside of the Player Group just below the Direction Group put these events

So its done, I could figured out how to play idle animation when the player is in collision with a wall but is up to you to do it. And check the speed of the animations in this demo is set to 0.15 maybe is better to set a lower value so the animation plays fast.

Play it here

Demo:

Grab the source code from GitHub