From 63d2a59042fb9d90a586ad85d8364de7c38aea8e Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Wed, 6 Nov 2024 22:35:04 +0100 Subject: next commit --- Game/States/Build/StateBuild.gd | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'Game/States') diff --git a/Game/States/Build/StateBuild.gd b/Game/States/Build/StateBuild.gd index ea06671..0bd5efb 100644 --- a/Game/States/Build/StateBuild.gd +++ b/Game/States/Build/StateBuild.gd @@ -19,18 +19,19 @@ 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(): + if current_builder_element: 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 - - Client.place_tower(placed_tower) - - if not Input.is_action_pressed("builder_tower_place_keep"): - current_builder_element.queue_free() - current_builder_element = null + if current_builder_element.can_build(): + var placed_tower = current_builder_element.element.instantiate() as Tower + + placed_tower.global_position = current_builder_element.global_position + + Client.place_tower(placed_tower) + + if not Input.is_action_pressed("builder_tower_place_keep"): + current_builder_element.queue_free() + current_builder_element = null if event.is_action_pressed("build_mode_start"): get_viewport().set_input_as_handled() -- cgit v1.2.3