summaryrefslogtreecommitdiff
path: root/UI/hud.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-10-03 12:51:49 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-10-03 12:51:49 +0200
commit5442988a8ccecb9c323fc98557391a15ff245b87 (patch)
tree1864a03602291e2c495a8846b80ec90414060f61 /UI/hud.gd
parentc8bd14d6feeca72fc96b895c9382ebc16a1caf55 (diff)
next commit
Diffstat (limited to 'UI/hud.gd')
-rw-r--r--UI/hud.gd26
1 files changed, 26 insertions, 0 deletions
diff --git a/UI/hud.gd b/UI/hud.gd
index d5f7cc3..909dfa6 100644
--- a/UI/hud.gd
+++ b/UI/hud.gd
@@ -5,3 +5,29 @@ func _ready() -> void:
Game.score_changed.connect(func():
%Score.text = str(Game.score)
)
+
+ Game.speed_changed.connect(func():
+ %Speed.text = str(Game.speed).pad_decimals(1) + "x"
+ )
+
+
+func _on_button_blocker_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ Game.selected_unit_type = preload("res://Units/Blocker.tscn")
+
+func _on_button_digger_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ Game.selected_unit_type = preload("res://Units/Digger.tscn")
+
+func _on_button_miner_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ Game.selected_unit_type = preload("res://Units/Miner.tscn")
+
+
+func _on_button_plus_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ Game.speed = min(Game.speed + 0.5, 5)
+
+func _on_button_minus_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ Game.speed = max(Game.speed - 0.5, 0.5)