First_Person_Slapper/Start.gd

72 lines
1.9 KiB
GDScript3
Raw Normal View History

2022-10-11 14:32:39 -04:00
extends Control
var ingame = false
onready var NewGame = $"New Game"
onready var QuitGame = $"Quit Game"
onready var QuitDesktop = $"Quit to Desktop"
2022-10-12 08:22:40 -04:00
onready var MMusic = $"MenuMusic"
2022-10-12 14:15:05 -04:00
onready var CurrentLevel = $"../../Level"
onready var CurrLevelMenu = $"Level"
onready var Timer = $Timer
2022-10-12 12:21:18 -04:00
onready var Levels = {
2022-10-12 12:38:08 -04:00
"lvl1": "Level 1 - What did the five fingers say to the face? SLAP!",
"lvl2": "Level 2 - Something in the way...",
2022-10-12 14:15:05 -04:00
"lvl3": "Level 3 - But not too straight.",
2022-10-12 15:46:47 -04:00
"lvl4": "Level 4 - Memento Mori.",
2022-10-12 16:35:22 -04:00
"lvl5": "Level 5 - Hide and Slap.",
"lvl6": "Level 6 - Please remain calm.",
2022-10-12 17:26:31 -04:00
"lvl7": "Level 7 - Measure twice, slap once.",
2022-10-12 17:23:50 -04:00
"lvl8": "Level 8 - This is getting ridiculous!",
2022-10-12 12:38:08 -04:00
"lvl9": "Level 9 - ",
"lvl10": "Level 10 - ",
2022-10-12 13:48:39 -04:00
"lvl11": "Level 11 - I believe in a thing called BONK!",
2022-10-12 12:21:18 -04:00
"Spatial" : "I am Error.",
"" : "I also am Error."
}
2022-10-11 14:32:39 -04:00
func _ready():
2022-10-12 14:15:05 -04:00
CurrLevelMenu.text = Levels[get_tree().get_current_scene().get_name()]
CurrentLevel.text = CurrLevelMenu.text
2022-10-11 14:32:39 -04:00
QuitGame.hide()
QuitDesktop.margin_top -= 44
QuitDesktop.margin_bottom -= 44
2022-10-12 12:21:18 -04:00
MMusic.play()
get_parent().show()
get_tree().paused = true
2022-10-11 14:32:39 -04:00
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func _on_Quit_to_Desktop_Button_pressed():
get_tree().quit()
func _on_New_Game_pressed():
2022-10-12 08:22:40 -04:00
get_parent().hide()
2022-10-12 14:15:05 -04:00
if !ingame:
CurrentLevel.show()
Timer.start()
2022-10-11 14:32:39 -04:00
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
get_tree().paused = false
ingame = true
2022-10-12 08:22:40 -04:00
MMusic.stop()
2022-10-12 13:32:38 -04:00
if get_tree().get_current_scene().get_node("Music"):
get_tree().get_current_scene().get_node("Music").play()
2022-10-11 14:32:39 -04:00
func openMenu():
if (ingame):
NewGame.set_text("Continue Game")
QuitGame.show();
2022-10-11 14:57:56 -04:00
QuitDesktop.margin_top = 664
QuitDesktop.margin_bottom = 708
2022-10-11 14:32:39 -04:00
2022-10-12 08:22:40 -04:00
get_parent().show()
2022-10-11 14:32:39 -04:00
get_tree().paused = true
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
2022-10-12 12:21:18 -04:00
2022-10-11 14:32:39 -04:00
func _on_Quit_Game_pressed():
get_tree().reload_current_scene()
2022-10-12 12:21:18 -04:00
2022-10-12 14:15:05 -04:00
func _on_Timer_timeout():
CurrentLevel.hide()