0 votes

So im trying to get the animation working for my top down movement but i only have the run right and left animation and i cant seem to figure out how to program my player, so when my player is facing right and then goes up i want him to keep facing right and vice versa. i also cant figure out how to deal with the idle animation.. btw im using the animated sprite node...

this is the code btw. sorry if its so messy

func get_animation():
if velocity.x > 0 or velocity.x > 0 and velocity.y < 0 or velocity.y < 0:
    if velocity == Vector2.ZERO:
if velocity.x < 0 or velocity.x < 0 and velocity.y > 0 or velocity.y > 0:
    if velocity == Vector2.ZERO:
Godot version latest
in Engine by (19 points)
edited by

1 Answer

+1 vote
Best answer
if velocity==vector2.ZERO:
    if velocity.x!=0:

i think this will work

by (80 points)
selected by

thankyou very much

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.