State machine with 3 attacks, 3 air attacks, dash, wall jump


Hi mates, I made some test for a state machine and for my surprise I ended with something that may be intresting for some users a simple state machine thats include a 3 combo attack.

  • idle
  • walk
  • jump
  • fall
  • attack_1
  • attack_2
  • attack_3
  • air_attack_1
  • air_attack_2
  • air_attack_3
  • dash

I’ve also post a mini tutorial here
A playable demo here itchio here

Source code: here
Oh! by the way it’s MIT Lisence so you can use the code in any project you want, just note the hero asset must be attributed to his creator, the link for the hero asset plus a lot of other animations are included there.

Hope this help someone.


[Solved] Controller and walking animation
[Solved] How to make my charakter dash?
Wanted: videos of your games made with GDevelop!
I need a state machine and having Problems when my game is being tested the animations won't go past 2

Looks really good :+1:


That’s awesome!! thanks for sharing this one, this combo attack will help me with my next game
“Miko Mind Dreamer”
Thank you again … I’ll keep this page in my notes for the future when I resume the development.


How do you determine if a skill causes damage? Edit hit boxes affect roles…


This could be done in a lot of ways, is up to the game develpoper to decide.
The basic is to add a little square Sprite when the player attack and then check if that Sprite collides with other object, could it be an enemy or destructible or anything.




Thanks for sharing the project source, Ulises! It will be handy for my future reference in my games. There is a lot of good ideas in there.

For your example to be added to the GDevelop base, it will need a bit of clean up, I guess. There are unused elements in your project, like obj_floor_colision for example.

Also, to be added to GDevelop examples list, it has too many functionalities in just one place. Consider breaking it in smaller examples, for each purpose individually, like:

  1. Code example 1: Platform movement - dash with smoke trail effect
  2. Code example 2: Platform movement - sliding by walls
  3. Code example 3: Platform control using the GAMEPAD extension
  4. Code example 4: Finite state machine - platformer combo moves

For the Finite State Machine logic, instead of using one a 0/1 variable for each state like you are doing, have you considered using one single variable to manage the player multiple states? Like this:

  • gs_player_state = "by wall left"
  • gs_player_state = "by wall right"
  • gs_player_state = "jumping"
  • gs_player_state = "moving"
  • gs_player_state = "attacking"

One little last thing, you misspelt the variable name gs_jump_count.

Anyways, good job and thanks for sharing :+1:


Thanks a lot for the feedback.


Looks pretty clean to me, I like it. I like it.

I’ve been doing FSM by using animations, but can already see some longterm issues that I might clean up by switching to a single state variable as mentioned above.

A few questions:

  • You have some variables/events set up to detect the walls.
    • Any reason why you went that way instead of having your platforms in a “Platform” object group and using “Is in collision with PlatformGroupname”, your jumping state, and “is object horizontally flipped”?
  • I’ve currently ended up making each of my states be wholly separate external events that only get loaded if the condition for the state is met. It also means I have ~13+ external event sheets. I originally did this because this was how the FSM tutorial on the wiki showed to do it, but then I kept it because it made me think “This way there can be no false state triggers/conflicts between transitions”.
    • Have you seen any conflicts from having them all on the one sheet at all?


Questions: please when you add questions try number lists it’s easy to answer. :slight_smile:
1 - Walls are in groups, it’s done like that because is easy to integrate other sprites to act as walls, the variables created just to ensure the collision. I couldn’t find a better way to do this, note I’m total noob in GDevelop.
2 - 1 event sheet or 20 event sheets, is the same if the code works, it’s ok no?
3 - Some of the animations, triggers again when try to limit the attack number.
When I have some time i will remake the state machine to just one variable, right now I’m with A Pixel Adventure Legion and is a lot of work to do there.


Thanks for the info. Either way, I think it’s really clean and a fine alternative to the FSM tutorial on the wiki. Once I’m done with (slowly) doing my save system, I might redo my FSM to something similar and test out the results.