72 lines
1.9 KiB
GDScript
72 lines
1.9 KiB
GDScript
extends Control
|
|
|
|
var ingame = false
|
|
onready var NewGame = $"New Game"
|
|
onready var QuitGame = $"Quit Game"
|
|
onready var QuitDesktop = $"Quit to Desktop"
|
|
onready var MMusic = $"MenuMusic"
|
|
onready var CurrentLevel = $"../../Level"
|
|
onready var CurrLevelMenu = $"Level"
|
|
onready var Timer = $Timer
|
|
|
|
onready var Levels = {
|
|
"lvl1": "Level 1 - What did the five fingers say to the face? SLAP!",
|
|
"lvl2": "Level 2 - Something in the way...",
|
|
"lvl3": "Level 3 - But not too straight.",
|
|
"lvl4": "Level 4 - Memento Mori.",
|
|
"lvl5": "Level 5 - Hide and Slap.",
|
|
"lvl6": "Level 6 - Please remain calm.",
|
|
"lvl7": "Level 7 - Eye can deceive you, only trust yourself.",
|
|
"lvl8": "Level 8 - ",
|
|
"lvl9": "Level 9 - ",
|
|
"lvl10": "Level 10 - ",
|
|
"lvl11": "Level 11 - I believe in a thing called BONK!",
|
|
"Spatial" : "I am Error.",
|
|
"" : "I also am Error."
|
|
}
|
|
|
|
func _ready():
|
|
CurrLevelMenu.text = Levels[get_tree().get_current_scene().get_name()]
|
|
CurrentLevel.text = CurrLevelMenu.text
|
|
QuitGame.hide()
|
|
QuitDesktop.margin_top -= 44
|
|
QuitDesktop.margin_bottom -= 44
|
|
MMusic.play()
|
|
get_parent().show()
|
|
get_tree().paused = true
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
|
|
func _on_Quit_to_Desktop_Button_pressed():
|
|
get_tree().quit()
|
|
|
|
func _on_New_Game_pressed():
|
|
get_parent().hide()
|
|
if !ingame:
|
|
CurrentLevel.show()
|
|
Timer.start()
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
get_tree().paused = false
|
|
ingame = true
|
|
MMusic.stop()
|
|
if get_tree().get_current_scene().get_node("Music"):
|
|
get_tree().get_current_scene().get_node("Music").play()
|
|
|
|
func openMenu():
|
|
if (ingame):
|
|
NewGame.set_text("Continue Game")
|
|
QuitGame.show();
|
|
|
|
QuitDesktop.margin_top = 664
|
|
QuitDesktop.margin_bottom = 708
|
|
|
|
get_parent().show()
|
|
get_tree().paused = true
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
|
|
|
|
func _on_Quit_Game_pressed():
|
|
get_tree().reload_current_scene()
|
|
|
|
func _on_Timer_timeout():
|
|
CurrentLevel.hide()
|