diff options
Diffstat (limited to 'Towers')
-rw-r--r-- | Towers/Tower.gd | 18 |
1 files changed, 6 insertions, 12 deletions
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() |