Two keys for animations

Hi, i’m new to GDevelop and to the forum.
Today i’ve tried to make an 8 direction movement sytem for a character. This project shall be an RPG-Character-Controller. The 4 directions does work, but when i try to play an animation with two keys it doesn’t work. I’ve made a screenshot of my events:

The third one is the one, where i’ve tried to setting up 2 keys for the animation, but the animation doesn’t work. The movement is okay, but my testgame doesn’t play it.
Anyway, thanks for the nice software and - in advance - for help :slight_smile:

Welcome!, and thanks for posting the screenshot, it’s a lot easier this way :wink:
The problem is just the order of events, in the event 3, GD set animation 3 if you press the “a” and “s” keys simultaneously, but then, in the event 5, you are pressing “a” so GD change the animation to 4, finally you see your character rendered with the final animation (4) :slight_smile:
*Just put the event 5 over the event 3.

By the way, it is not necessary to add the advanced “AND” condition when all the conditions in the event must be met, it is the default behavior.

Hi and thanks for your post, Lizard-13.
I’ve done it so far like you said, but now i have another problem: The movement is okay, the direction, too, but, GD don’t shows the animation. I’ve tried several ways, but the animation is not shown. I’ve made a new screenshot of my current project:

It’s strange, that it doesn’t works. My object is not animated in this direction. GD only shows the first frame. Maybe there’s a problem with the condition “player is stopped”. Do you can take a look over this? Thank you :wink:

Oh… excuse me, I should have realized that there was another problem. It’s because when an animation is changed, the new animation is (of course) reset.
If you follow your events, when you move in diagonal: in event 2, the animation is set to 4, in the event 3 set to 2 and in the event 4 set to 3. In every change, the new animation is reset, so the last animation allways be at frame 1.
There are two basic ways to solve it:

  • With variables and/or sub-events (it’s complex and unnecessary because the next point)
  • With the Top-Down Movement Automatism (an automatism/behavior that makes automatically what you need) :smiley:

To use the top-down automatism, you have to activate it in the Extensions window (at the left window), then you can apply it in your Player object in the properties panel; you can set controls, allow diagonals, set speed, acceleration, etc.

Let us know if you need help with the automatism or to set your own movement controls with variables and sub-events :wink:

Hi Lizard-13.
You said it’s complex and unnecessary to do it this way (with variables). Because i’m a beginner i would like to learn more about point 2: Top-Down Movement Automatism. I’ve activated the extension and i got some more commands. But, at the point automatism there’s everything empty:

What do i need to create the Automatism? Thanks again for any help.

You should add the automatism to the object before using it in the events (edit the object “other properties” from the object editor and add an aitomatism here).

Okay, i added the automatism, thanks victor.
Unfortunately, this doesn’t works, too. I found out this: When i remove all the keys for the playercontroller and only have the condition of the two keys, then it works. That’s strange. Any ideas what i can do to fix this problem? Maybe i’ve worked wrong. Thanks for helping me :wink:

Edit: Ha! Now i got it! I’ve made a small mistake: I turned off the rotation with 0. It must be 180. I used the default options for the control, and added this to the event editor:

Thanks for your great help :slight_smile:
Now i will make the next step…