Animation freezes when 2 keys are pressed at the same time

Hi! I am new to Gdevelop, and I am trying to make an RPG game. So I got the character movement’s down but whenever I press the down arrow and right arrow or something, my character moves down but he is stuck in a frame of his walking animation. My game does not have any corner movement and I want to keep it like that and I don’t want to make sprites for that. I just want to make a simple RPG with as less glitches possible I can make it.

It sounds like the animation(s) are being restarted each of the game’s frames (basically frozen, as you said).
The easiest way to prevent this is by going to the events that change the character’s animations (to Right, Down animations …), and adding a “Trigger Once” condition.

If your character stops moving just after you press the directional button, create a sub-event and put both Trigger Once and the “animation change” action. This will reset the animations only once when the buttons are pressed. Like so :

When you develop on the web the solution is almost always to “clear the cache”.
In Gdevelop it’s “Trigger once”

1 Like

Thank you, but there is 1 problem with it. Whenever I press both keys now, it’s fixed, but when I let go of one of the keys, the animation locks again. It all fixes once I let go and press one key again, do you have a solution to this? If you want, I’ll be happy to send you a photo of my events.

You’ll probably want to include a screenshot here of your events.

However, you’ll probably need to do some kind of “who’s on first” style events.

e.g. Put a “firstKey” variable on your character.
On your events:

If Key1 is pressed                                          | Do action 1
If Object.firstKey != "Key2" OR If Object.firstKey = "Idle" | Set Object.firstKey = "Key1"
If Key2 is pressed                                          | Do action 2
If Object.firstKey != "Key2" OR If Object.firstKey = "Idle" | Set Object.firstKey = "Key2"
If Key 2 is pressed (Inverted) | Set Object.firstKey = "Idle"
If Key 1 is pressed (Inverted) |

Yes, I would love to see directly what your events are, since the solution will then be matched to how your game’s code is. (I wonder if there will be a tip that reminds people to do so everytime they create a How do I… topic)
Still, if Silver-Streak’s explanation solves your problem, that’s great too!

Here is a pic of my events.

Thanks, but now I need clarification on your events.
What is animation numbers 3,0,1,2?
What are the other animation numbers 7,4,5,6? Why do they happen when the key is released?
Your events sheet should probably work(although it’s strange to read), so it might be with how you configured your animations, or that the “Key is released” is causing you problems, and you’d need to make the animation system again.

Key Released is an “always” condition, so you’re going to run into issues if any of those keys have ever been pressed since they don’t have a trigger once.

“Left Key is released” will always be true after the Left Key is pressed, so that is conflcting with the others.

As Cat mentions, you will likely need to redo all of your animation events. You’ll need to start putting in a lot of exclusionary rules (e.g. “Down key is pressed” AND “Left key is not released” AND “Left key is not pressed”, etc) to make what you have above work.

As requested, describe what all of these animations are for and what your goal is, and we might be able to provide better suggestions.

I just recreated the walking system. It seems to work great! I just need some tips. Please visit my latest post.