summaryrefslogtreecommitdiff
path: root/Game/States/Build/StateBuild.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-06 22:35:04 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-06 22:35:04 +0100
commit63d2a59042fb9d90a586ad85d8364de7c38aea8e (patch)
treef4c648b39313f10f44898d0216a9147dfb4ba491 /Game/States/Build/StateBuild.gd
parentf20b3a48a14f34def41d823fabb476981ef7055e (diff)
next commit
Diffstat (limited to 'Game/States/Build/StateBuild.gd')
-rw-r--r--Game/States/Build/StateBuild.gd21
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()