-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHUD.gd
More file actions
30 lines (23 loc) · 698 Bytes
/
Copy pathHUD.gd
File metadata and controls
30 lines (23 loc) · 698 Bytes
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
extends CanvasLayer
signal start_game
func _ready():
$MessageTimer.connect("timeout", self, "_on_MessageTimer_timeout")
$StartButton.connect("pressed", self, "_on_StartButton_pressed")
func show_message(text):
$MessageLabel.text = text
$MessageLabel.show()
$MessageTimer.start()
func show_game_over():
show_message("Game Over")
yield($MessageTimer, "timeout")
$MessageLabel.text = "Dodge the \nCreeps!"
$MessageLabel.show()
yield(get_tree().create_timer(1), 'timeout')
$StartButton.show()
func update_score(score):
$ScoreLabel.text = str(score)
func _on_MessageTimer_timeout():
$MessageLabel.hide()
func _on_StartButton_pressed():
$StartButton.hide()
emit_signal("start_game")