-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHUD.gd
46 lines (29 loc) · 857 Bytes
/
HUD.gd
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
34
35
36
37
38
39
40
41
42
43
44
45
46
extends CanvasLayer
signal start_game
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
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 Creeps!"
$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")