diff --git a/Scripts/PlayerController.gd b/Scripts/PlayerController.gd index 310a71a..584f977 100644 --- a/Scripts/PlayerController.gd +++ b/Scripts/PlayerController.gd @@ -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