Diagonal Movement Fix and Textures

This commit is contained in:
AXVIII3 2023-04-08 01:02:56 +05:30
parent b1e63481fe
commit 8e03e10593

View file

@ -33,5 +33,11 @@ func update_player_animation():
Vector2.RIGHT: animation_player.play("MoveRight")
Vector2.UP: animation_player.play("MoveUp")
Vector2.DOWN: animation_player.play("MoveDown")
_: animation_player.play("Idle")
_: handle_diagonal_animations(move_vector)
pass
func handle_diagonal_animations(dir : Vector2):
if (dir.y > 0 and dir.x < 0) or (dir.y < 0 and dir.x < 0): animation_player.play("MoveLeft")
elif (dir.y > 0 and dir.x > 0) or (dir.y < 0 and dir.x > 0): animation_player.play("MoveRight")
else: animation_player.play("Idle")
pass