-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI.gd
44 lines (29 loc) · 1.07 KB
/
GUI.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
extends CanvasLayer
# 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():
print("hide gameover")
$GameOver.hide()
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_Character_gameover():
$GameOver/GameOverText.text = "Game Over"
$GameOver/BaguettesText.text = "%s %s found" % [$MarginContainer/BaguetteCount/Value.text, $MarginContainer/BaguetteCount/outOf.text]
$GameOver.show()
get_tree().paused = true
func _input(event):
if Input.is_key_pressed(KEY_SPACE) and $GameOver.is_visible_in_tree():
restartGame()
func _on_Button_button_down():
restartGame()
func restartGame():
get_tree().paused = false
get_tree().change_scene("res://TestScene.tscn")
func _on_Stair_body_entered(body):
$GameOver/GameOverText.text = "Game Won"
$GameOver/BaguettesText.text = "%s %s found" % [$MarginContainer/BaguetteCount/Value.text, $MarginContainer/BaguetteCount/outOf.text]
$GameOver.show()
get_tree().paused = true