-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMenuScreen.gd
43 lines (30 loc) · 1.1 KB
/
MenuScreen.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
extends MarginContainer
signal continue_game
signal new_game(with_tutorial: bool)
func _ready():
$VBoxContainer/Buttons/Start.pressed.connect(_on_game_start)
$VBoxContainer/Buttons/Tutorial.pressed.connect(_on_tutorial)
$VBoxContainer/Buttons/Continue.pressed.connect(func(): continue_game.emit())
$VBoxContainer/Buttons/Credits.pressed.connect(_on_credits)
$VBoxContainer/Credits.back.connect(_on_credits_back)
$VBoxContainer/Buttons/Continue.visible = false
## Start a new game
func _on_game_start():
new_game.emit(false)
# wait for camera transition to finish
await get_tree().create_timer(2).timeout
$VBoxContainer/Buttons/Continue.visible = true
## Start a new game in tutorial mode
func _on_tutorial():
new_game.emit(true)
# wait for camera transition to finish
await get_tree().create_timer(2).timeout
$VBoxContainer/Buttons/Continue.visible = true
## Open the credits
func _on_credits():
$VBoxContainer/Buttons.visible = false
$VBoxContainer/Credits.visible = true
## Close the credits
func _on_credits_back():
$VBoxContainer/Buttons.visible = true
$VBoxContainer/Credits.visible = false