-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.gd
38 lines (30 loc) · 800 Bytes
/
Menu.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
extends CanvasLayer
signal start_game
func _ready():
$Music.play()
func show_message(text):
$Message.text = text
$Message.show()
$MessageTimer.start()
func show_game_over():
show_message("Game Over")
$Music.stop()
$DeathSound.play()
# Wait until the MessageTimer has counted down.
yield($MessageTimer, "timeout")
$Message.text = "Shoot the Planes"
$Message.show()
# Make a one-shot timer and wait for it to finish.
yield(get_tree().create_timer(1), "timeout")
$DeathSound.stop()
$Music.play()
$StartButton.show()
func update_score(score):
$ScoreLabel.text = str(score)
func update_bulletcount(bulletcount):
$BulletLabel.text = str(bulletcount)
func _on_StartButton_pressed():
$StartButton.hide()
emit_signal("start_game")
func _on_MessageTimer_timeout():
$Message.hide()