Set animation and flipping player when both left right keys pressed?

Hello I am having two issues I can’t figure out any help would be greatly appreciated.

First issue having trouble with setting the animation to “idle” when both left and right keys are pressed?

Second issue is how to set player flipping for example when RIGHT key is held and LEFT key is pressed the player does not flip which is what I want. BUT when LEFT key is held then RIGHT key is pressed the player flips? How do I stop the player flipping back?

I didn’t notice this issue myself, thank you. now I corrected it in my own project.
I added an object variable to the hitbox object, wich is indicates the direction.

the controls part:

the animation part:

be sure the controls executed before the animation.
may be this isn’t the best solution. if anybody have better, please share it.

1 Like

Thanks that fixed the flipping issues and is now working :open_mouth:
But now when both left and right is pressed the idle animation gets stuck on the first frame?

I don’t know sorry. my idle “animation” is only one frame. but why are you want to hold down the opposite directions at the same time, for a long time? just release them. my project is a simple platformer where it makes no sense to go both directions in the same time. this mechanic’s function is to stop the player, when he accidentally presses the other direction while running. the player wants to run, so he will release the buttons as soon as possible. in my opinion.

Haha you’re right it makes no sense except I’m trying to recreate Ninja Gaiden 3 on the NES. The first level in order to learn GDevelop and have a template for my own game later. I’m trying to copy the controls exactly and holding both keys plays the idle animation :thinking: I don’t know why stuck on the first frame though.

because the action executes in every cycle. in other words it restart all the time. try to add a “trigger once” condition that event.
unfortunately I don’t know the Ninja Gaiden series.

1 Like

you say NES? I cant remember the Nes controller exactly, but generally in a controller you can’t push both directions at the same time because the “D pad” waggle in it’s center.

I’m playing using RetroArch you can use keys. I know it’s not necessary I wanted see if this was possible to emulate.

if they can, then it is possible. the question is whether it is worth do exact the same thing like others do before?

Using the game as learning project for GDevelop and also as a reference/template for my own game later. The idea is recreate the entire first level and boss from scratch a clone of the original but made with GDevelop. When I’m done I will release for public download.

1 Like

If you’re still around maybe you can help? I’m still having trouble with animations I have no idea where to put trigger once in my events nothing I do is working? Also the attack animation only plays the first few frames then going back to idle :no_mouth:

Here is the animation part
Untitled

I didn’t do attack function so far. but I see when you attack, you release the “Z” button. in this frame the first sub-event in the screenshot will be true (the “trigger once” is in the wrong place), so this event will set the animation to idle. you should check the animation of player isn’t “attack”. I’m not sure, but may be this help.

1 Like