Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | pinklemonad3 |
Hey, I’ve been trying to make my AnimatedSprite (root node Area2D) move in 4 directions. Most of my code is from the video tutorial for How to Make Your First 2D Game in Godot Docs. I noticed that the tutorial only allowed for two animations to be played, so i tried to add another one (since i can’t flip my up and down animation, because they look different). here is the code of the animated sprite movement:
if direction.x != 0:
$AnimatedSprite.animation = "left_right"
$AnimatedSprite.flip_v = false
$AnimatedSprite.flip_h = direction.x < 0
elif direction.y > 0:
$AnimatedSprite.animation = "up"
elif direction.y < 0:
$AnimatedSprite.animation = "down"
I think the main problem is just that i’m not sure how to assign x and y values to different directions, so i tried using greater then and less then. When i play the scene, my sprite doesn’t move. When i do it with two animations, it does but i don’t know how to use more then one. If you have any help or know what i’m doing wrong/how to solve this it would really help. Thanks!!
side note: I don’t normally post in forums so if there’s any other information you need to help feel free to ask.
edit: just realised i was using the wrong keys. please excuse my stupidity =)