![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | dev_cons |
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:
animatedSprite.play("RunRight")
if velocity == Vector2.ZERO:
animatedSprite.play("IdleRight")
if velocity.x < 0 or velocity.x < 0 and velocity.y > 0 or velocity.y > 0:
animatedSprite.play("RunLeft")
if velocity == Vector2.ZERO:
animatedSprite.play("IdleLeft")