blob: 909dfa608ce294103503668eb0b608c3ddbb3673 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
extends CanvasLayer
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)
|