fix: change to elif for diagonal movement;

This commit is contained in:
2026-08-18 11:02:41 +02:00
parent 1146811e15
commit c93c391c0a
6 changed files with 5 additions and 5 deletions
+5 -5
View File
@@ -13,14 +13,14 @@ func _process(delta: float) -> void:
var move_vector: Vector2 = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
velocity = move_vector * move_speed
if velocity == Vector2(0, 0):
$AnimatedSprite2D.stop()
if velocity.x > 0:
$AnimatedSprite2D.stop()
elif velocity.x > 0:
$AnimatedSprite2D.play("move_right")
if velocity.x < 0:
elif velocity.x < 0:
$AnimatedSprite2D.play("move_left")
if velocity.y > 0:
elif velocity.y > 0:
$AnimatedSprite2D.play("move_down")
if velocity.y < 0:
elif velocity.y < 0:
$AnimatedSprite2D.play("move_up")
move_and_slide()