-
Notifications
You must be signed in to change notification settings - Fork 1
/
HUD.gd
36 lines (28 loc) · 804 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
extends CanvasLayer
signal start_game
func _ready():
# Called when the node is added to the scene for the first time.
# Initialization here
pass
func show_message(text):
$MessageLabel.text = text
$MessageLabel.show()
$MessageTimer.start()
func show_game_over():
$MessageLabel.text = "Game Over!"
$MessageLabel.show()
$GameOverTimer.start()
yield($GameOverTimer, "timeout")
$StartButton.show()
func update_score(score):
$ScoreLabel.text = str(score)
func _on_StartButton_pressed():
$StartButton.hide()
$MessageLabel.hide()
emit_signal("start_game")
func _on_MessageTimer_timeout():
$MessageLabel.hide()
$MessageTimer.stop()
func _on_GameOverTimer_timeout():
$MessageLabel.text = "Asteroids"
$GameOverTimer.stop()