How do I manage animations display while moving diagonally?

I’m fairly new and I already know that this is not the way, but what I did was to set the arrow keys to change the animation that was played when the key was pressed and released as you can see below:

What I’m trying to achieve is to move in a direction while playing an animation and when I stop moving play the idle animation facing that direction. And I did it.

Problem is with diagonal movement, the animations freeze, maybe because it has 2 inputs so the animation is changing all the time?

What I ultimately would like to have is a diagonal movement that plays the animation of the last key pressed or direction.
I think this shouldn’t be done with “Pressed Key” but instead it should be done with something like coordinates?

Guess my question is: What’s the best way to achieve this diagonal movement while playing the animation that corresponds to the last key pressed?

Do you have a specific animation for moving diagonally? I guess then you could use the “And” condition under “Advanced” section to check if both the left and down keys are pressed at the same time. Otherwise to keep track of which key was hit the last time you would have to do that with variables, I think. I’m new as well so take it with a grain of salt :stuck_out_tongue:

I don’t have animations for moving diagonally but I guess I could try and make something with “and” I didn’t pay more attention to the “pressed key” because maybe it’ll make a conflict if I use arrows to move through menus, I’ll try tho. Thanks :slight_smile:

I’ll update as I go. I just encountered a bug involving file names that took a good portion of my time, I reported it already.

As Medelsvensson mentioned, I tried variables to keep track of the last pressed key. And it worked If someone had the same doubt It looks like this:
https://i.imgur.com/mzSwHG3.jpg

(I haven’t added the idles for every direction with this method yet, but it should be easy enough)

Right now I use 4 variables, but I guess I could get the same result with 1 variable, playing with the numbers.
Should I make it 1 variable only? What are the benefits performance wise? bet it’s not really significant.