fix: change to elif for diagonal movement;
This commit is contained in:
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -13,14 +13,14 @@ func _process(delta: float) -> void:
|
|||||||
var move_vector: Vector2 = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
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):
|
if velocity == Vector2(0, 0):
|
||||||
$AnimatedSprite2D.stop()
|
$AnimatedSprite2D.stop()
|
||||||
if velocity.x > 0:
|
elif velocity.x > 0:
|
||||||
$AnimatedSprite2D.play("move_right")
|
$AnimatedSprite2D.play("move_right")
|
||||||
if velocity.x < 0:
|
elif velocity.x < 0:
|
||||||
$AnimatedSprite2D.play("move_left")
|
$AnimatedSprite2D.play("move_left")
|
||||||
if velocity.y > 0:
|
elif velocity.y > 0:
|
||||||
$AnimatedSprite2D.play("move_down")
|
$AnimatedSprite2D.play("move_down")
|
||||||
if velocity.y < 0:
|
elif velocity.y < 0:
|
||||||
$AnimatedSprite2D.play("move_up")
|
$AnimatedSprite2D.play("move_up")
|
||||||
|
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|||||||
Reference in New Issue
Block a user