How do I change animations in isometric game

I’m making an isometric game and supposed to be for mobile. It has a multitouch control(8 ways).
The sprite has 8 animations each for idle(isNOTmoving) and run (ismoving). 8 animations each for the 8 direction in the control/joystick. All animations for idle and run is on loop.

I was able to work out the change animation for the idle and run, but now when i add an attack button the attack animation does not apply(I used the “button is pressed condition = change animation to Attack”), but when i disable the idle and run event animations it proceeds to do the attack animation.

My expected results are that depending on which direction the player is facing(Up,Down, UpLeft, etc) the appropriate animation should be applied. When the player is not moving the idle animation should be played and when the player is moving the proper run animation should also be played. Regardless of whether the player is moving or not, when the attack button is pressed it should also play the correct direction of attack animation.

I’m new at Gdevelop and I do not know if what i did at idle and run animations are correct or if there is a better way to do it. My guess is that the engine is getting confused with the animations because of my spaghetti events.

Below are screenshot of my events:

1 Like

You need to add more conditions to animations. For example, you have a “direction” object variable, you need to check this variable in the condition. If direction = “right” and the attack button is pressed, then play the “attack right” animation, also you need to turn off the running animation, this can be done using a new variable , let’s call it “AttackON” and set its value to 1 when the attack is activated, also adding a condition to the running animation that “AttackON” = 0 so that it doesn’t work while attacking, also don’t forget to change this variable back to 0 when attack is off. There are actually a lot of things you can do, but I hope I helped you understand.


Thanks. I was able to work it out. Its just that i need to first move the character for all the animations to work. If i preview and the first thing i click is the attack button all the animations do not work.

Should i initialize the AttackON variable(=0) or leave it blank at the edit variable panel?
Also, if you could kindly explain the sub events and if hierarchy of events matter?