diff options
Diffstat (limited to 'Game/States')
-rw-r--r-- | Game/States/Build/StateBuild.gd | 21 |
1 files changed, 11 insertions, 10 deletions
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() |