Basic Movement and Map Generation #22
1 changed files with 7 additions and 1 deletions
|
@ -33,5 +33,11 @@ func update_player_animation():
|
||||||
Vector2.RIGHT: animation_player.play("MoveRight")
|
Vector2.RIGHT: animation_player.play("MoveRight")
|
||||||
Vector2.UP: animation_player.play("MoveUp")
|
Vector2.UP: animation_player.play("MoveUp")
|
||||||
Vector2.DOWN: animation_player.play("MoveDown")
|
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
|
pass
|
||||||
|
|
Reference in a new issue