From 5b35174ffab42f0331f1a6527ef6bbab7a3dbdcb Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sat, 21 Dec 2024 14:15:11 +0100 Subject: next commit --- Towers/Tower.gd | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'Towers') diff --git a/Towers/Tower.gd b/Towers/Tower.gd index 73b1614..c3da1fd 100644 --- a/Towers/Tower.gd +++ b/Towers/Tower.gd @@ -7,17 +7,11 @@ signal deselected signal selected_secondary -static var selected_towers: Array[Tower] -static var hovered_tower: Tower - var is_selected := false: set(value): if value: - if not Tower.selected_towers.has(self): - Tower.selected_towers.append(self) - selected.emit() + selected.emit() else: - Tower.selected_towers.erase(self) deselected.emit() is_highlighted = false is_selected = value @@ -26,12 +20,9 @@ var is_selected := false: var is_hovered := false: set(value): if value: - hovered_tower = self Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND) else: - if hovered_tower == self: - hovered_tower = null - Input.set_default_cursor_shape(Input.CURSOR_ARROW) + Input.set_default_cursor_shape(Input.CURSOR_ARROW) is_hovered = value queue_redraw() @@ -61,7 +52,10 @@ func _init(): func _ready(): $AnimatedSprite2D.play() - for component in [preload("res://Towers/Components/RangeComponent.tscn").instantiate(), preload("res://Towers/Components/AttackComponent.tscn").instantiate()]: + for component in [ + preload("res://Towers/Components/RangeComponent.tscn").instantiate(), + preload("res://Towers/Components/AttackComponent.tscn").instantiate() + ]: add_component(component) redraw_components() -- cgit v1.2.3