init
This commit is contained in:
19
player/scripts/player_interactions_host.gd
Normal file
19
player/scripts/player_interactions_host.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
class_name PlayerInteractionsHost extends Node2D
|
||||
|
||||
@onready var player: Player = $".."
|
||||
|
||||
func _ready() -> void:
|
||||
player.direction_change.connect(update_direction)
|
||||
|
||||
func update_direction(new_direction: Vector2) -> void:
|
||||
match new_direction:
|
||||
Vector2.DOWN:
|
||||
rotation_degrees = 0
|
||||
Vector2.UP:
|
||||
rotation_degrees = 180
|
||||
Vector2.LEFT:
|
||||
rotation_degrees = 90
|
||||
Vector2.RIGHT:
|
||||
rotation_degrees = 270
|
||||
_:
|
||||
rotation_degrees = 0
|
||||
Reference in New Issue
Block a user