From f20b3a48a14f34def41d823fabb476981ef7055e Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 6 Nov 2024 21:00:56 +0100 Subject: next commit --- Game/States/Build/StateBuild.gd | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Game/States') 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") -- cgit v1.2.3