fix: add stop for animatedSprite2D;

This commit is contained in:
2026-08-18 09:59:31 +02:00
parent da338dacf5
commit 1146811e15
+4 -5
View File
@@ -11,17 +11,16 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
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
velocity = move_vector * move_speed
if velocity == Vector2(0, 0):
$AnimatedSprite2D.stop()
if velocity.x > 0:
$AnimatedSprite2D.play("move_right")
print(velocity)
if velocity.x < 0:
$AnimatedSprite2D.play("move_left")
print(velocity)
if velocity.y > 0:
$AnimatedSprite2D.play("move_down")
print(velocity)
if velocity.y < 0:
$AnimatedSprite2D.play("move_up")
print(velocity)
move_and_slide()