diff options
Diffstat (limited to 'Game/States/Build/StateBuild.gd')
-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") |