Godot Ver 4.2.1
Question
I am trying to make the animation different for each movement in my game please help
Godot Ver 4.2.1
I am trying to make the animation different for each movement in my game please help
You have type mismatch.
You trying to ask if type Vector2 equal to type String (“left”). So you need to ask if string == string or Vector2 == Vector2
k I fixed that it still won’t work
I’ve built a few RPG demos and used different code. This is from my latest work:
var anim = $AnimatedSprite2D
if velocity.x > 50 and velocity.y == 0:
anim.play("walk _right")
if velocity.x < -50 and velocity.y == 0:
anim.play("walk_left")
You could place a print statement before the move_and_slide to see the actual value of the input_direction and use that to adjust your coding.