class_name PlayerUnit extends Node2D @export var direction: Corner = CORNER_BOTTOM_RIGHT @export var max_hp := 0 @export var current_team: String var current_hp := 0: set(value): current_hp = value $Label.text = str(value) func _ready() -> void: current_hp = max_hp $Label.visible = false var grid_selector := get_tree().get_first_node_in_group("grid_selector") as GridSelector grid_selector.hover_enter.connect(func(node: Node2D): $Label.visible = node == self ) grid_selector.hover_exit.connect(func(): $Label.visible = false ) func _process(_delta: float) -> void: if direction == CORNER_TOP_LEFT: $AnimatedSprite2D.play("top_left") $AnimatedSprite2D.flip_h = false elif direction == CORNER_TOP_RIGHT: $AnimatedSprite2D.play("top_left") $AnimatedSprite2D.flip_h = true elif direction == CORNER_BOTTOM_LEFT: $AnimatedSprite2D.play("bottom_right") $AnimatedSprite2D.flip_h = true elif direction == CORNER_TOP_LEFT: $AnimatedSprite2D.play("bottom_right") $AnimatedSprite2D.flip_h = false