diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-06 21:00:56 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-06 21:00:56 +0100 |
commit | f20b3a48a14f34def41d823fabb476981ef7055e (patch) | |
tree | 35608bd22ff3ec8d9210747df39186d212aa6ab7 /Game/States | |
parent | 6f17d6c1d458275e8744d57a7f433cc3eb5434d7 (diff) |
next commit
Diffstat (limited to 'Game/States')
-rw-r--r-- | Game/States/Build/StateBuild.gd | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Game/States/Build/StateBuild.gd b/Game/States/Build/StateBuild.gd index e7f122d..ea06671 100644 --- a/Game/States/Build/StateBuild.gd +++ b/Game/States/Build/StateBuild.gd @@ -19,8 +19,9 @@ func _state_exit(): func _state_input(event: InputEvent): if event.is_action_pressed("builder_tower_select"): - if current_builder_element and current_builder_element.can_build(): + get_viewport().set_input_as_handled() + var placed_tower = current_builder_element.element.instantiate() as Tower placed_tower.global_position = current_builder_element.global_position @@ -41,9 +42,12 @@ func _state_input(event: InputEvent): set_state("StateDefault") if event.is_action_pressed("builder_cancel") and current_builder_element: + get_viewport().set_input_as_handled() + current_builder_element.queue_free() current_builder_element = null -func _state_unhandled_input(_event: InputEvent) -> void: - pass +func _state_unhandled_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + set_state("StateDefault") |