Animation, movment, & Button mapping in top-down

I’m fairly new to GDevelop, but I have messed around in other game developing software before. I seen there was a post that showed how to fix the dual movement animation freeze (up & right, up & left, right & down, Etc.) I tried that and it worked, but I still had a few issues. I was trying to figure out how to do all that, make my character animate in the correct directions, and use (WADS) instead of the arrow keys. So I kept at it, trying to figure out how to change and fix it. (didn’t seem like too hard of a problem to fix) Eventually 3-4 hours go by, searching on forums and the internet in general, and I still can’t figure it out. Please help, Idk what I’m doing wrong.

Changed the animation out of the movement, now I got it all working expect for one small change I can’t seem to figure out for the life of me. I am trying to achieve an omni-animation like movement to my character, the characters actual movement is perfect. I got (holding up, & right looks right, holding up, & left looks left) when let go of one of those directions while still holding up (character stays in animation the whole time btw) it goes back to its original up animation. these animations work both with up and down, now I just can’t seem to apply these directions with right & up, right & down, left & up, left & down. please help.

Thx for your time :slight_smile:

Code it based on angles
idk what ur project is but if ur planning on making something BIG

this will help in long run
Example when ur coding key rebinding’s or controller settings



Hope This Helps :smiley:

Edit; Also if its based on angles it wont be based off your key presses which can cause minor animation glitches :stuck_out_tongue:

example of what my code looks like

Hey, thanks for the reply. From what I seen, I don’t think that is the fix I’m looking for. But I can still give it a go. I have the movement the way I want it (for now at least) but I want the animation to work where the last key held takes priority with the animation direction. I’ll let you know if it works when I’m done with it.

You are trying to force your way trough it and that is stupid
How do i know?
Cause we all did it the same way cause it was only thing that came to our minds at that time

You need to stop thinking that something that needs to be done the way it should be done
And think about cheating your way trough it
You do not need to change animation to whatever button is pressed

In fact you only need to change animation to where player is moving

Look at my player animations


I have animation for each direction

Look at their names it is always Direction + Activity
So Down Idle or Left Move or Up Swim

Right now we care only about move and idle
I made variable for my player called PlayerDirection


I simply set it to Down Left Right or Up
Depending in which direction player is moving

Where as you see in parent event i check if player is moving
And now these events are all i need

I change animatuion of player to variable PlayerDirection + Move or Idle

So that variable + that text create name of animations i gave them which you seen in 1st two screenshot in this post of mine

And it works perfectly with WASD or arrows

But that is because i added to my player behavior one called remap for topdown

Which lets you remap your movement keys

I was just using the basic top down tutorial, (just for starting my game and learning the basics for it) so I don’t have custom made animations in specific directions. Do I need to create custom animations right now, or can I keep the basic one and do those later when I come up with the Idea for how I want the character to look?

And because you was following some tutorial you did it the way it was done in it accepting it as proper way to do it
Where as you see you need to think outside of box to do something better that does not create conflicts

And i don’t understand your question?
What custom animations?
Are you talking about diagonals?
Cause i see you have up down left right

If you do mean diagonals it plays NO role when you gonna add them
This stuff is modular

Yet for 2d topdown i would question need for diagonlals
For me going up left and up right is same animation as going up
I see no reason to add diagonal animation for it
Same with down left and right it is just down animation

BUT nothing is stopping you from adding it now or later if you want

ONLY reason for me to add diagonal animations is if my player can attack diagonally and then diagonal animations makes 100% sense

Anyway choice is yours

I just meant how you have multiple animations for one direction, I didn’t mean “custom animations” I looked at it wrong. (left idle, left action, left move, Etc.) whereas I have 1 animation for each direction, specifically for movement only (currently).

Its a bit hard for me to think outside the box when I’m still pretty new to game developing. Cause even the most basic of things are a bit confusing lol.

Also with the animations question, I just meant like, I would like to have the last key held make the animation face that direction. So like If I held Up and Right, my character would face right and ignore the Up animation, but when I stop holding Right, I would like my character to continue to face Up seeing as I’m still holding it down. same for each direction. Up Right, Up Left, Down Right, Down Left, Right Up, Right Down, Left Up, Left Down.

Its pretty much just a key priority thing I’m looking for.

“For me going up left and up right is same animation as going up”

Also you mean to say, going Up and Right/Up and Left would just have the character face up while moving Right/Left?

How I originally had it, was perfect, just I couldn’t get the animations to work with the directions in which I was moving with two or 1 keys pressed.

Your animation for your gd.games game pressing Left and Up, Left and Down, Right and Up, Left and Up, Was exactly the fix I was looking for, just not the movement.

HOLY MOLY R U TALKING ABT IDLE ANIMATIONS

DUDE MY GOD

You need to learn to think like a programmer???

The variable DIRECTION tells the game what your direction is
WHICH IS USEFUL because it tells the game your last direction


THIS IS MY IDLE ANIMATION CODE

I think there was a miscommunication???

Okay, so I used part of your animation direction + movement, and now it worked the way I wanted it to.

It wasn’t idle animations I was looking for, just for the animation + movement to move/look in the same direction as last key held including a second key.

Up and right, would look right and move right, then up and left would look left and move left, when I let go of left, it will look up and move up, same with right.

Also PMKNjuice, I hadn’t tried your movement yet cause I didn’t think it was the fix I was looking for, but it was, just without the diagonals.

I think “angle of movement” is exactly what I was looking for lol. I apologize for this all being a huge miscommunication.

Still probably might add angles in the future, but I wanted my character to look correct when moving.

I appreciate all the help I got, you both were very helpful.

https://www.kapwing.com/videos/675623c1a46cc4871cabd9e6