diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-12-21 14:15:11 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-12-21 14:15:11 +0100 |
commit | 5b35174ffab42f0331f1a6527ef6bbab7a3dbdcb (patch) | |
tree | 071530353b02f45fffc26aa4b0f43f7b901b3046 /Towers | |
parent | a854a1862a30632e49520f6e1e11333d5c8ff241 (diff) |
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() |