fix: add stop for animatedSprite2D;
This commit is contained in:
@@ -12,16 +12,15 @@ func _ready() -> void:
|
||||
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.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()
|
||||
|
||||
Reference in New Issue
Block a user