StormyExtraction/scenes/main/main.gd

40 lines
1 KiB
GDScript

extends Node
var fullscreen = false
func _ready() -> void:
loadStartMenu()
func _process(delta: float) -> void:
if G.extracted and get_child(0).name != "EndScreen":
loadEndScren()
if Input.is_action_just_pressed("fullscreen"):
if not fullscreen:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
fullscreen = true
elif fullscreen:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
fullscreen = false
func loadGame():
G.resetValues()
for i in get_children():
i.queue_free()
add_child(load("res://scenes/game/mainGame/main_game.tscn").instantiate())
func loadEndScren():
for i in get_children():
i.queue_free()
add_child(load("res://scenes/menu/endScreen/end_screen.tscn").instantiate())
func loadHelp():
for i in get_children():
i.queue_free()
add_child(load("res://scenes/menu/help/help.tscn").instantiate())
func loadStartMenu():
G.resetValues()
for i in get_children():
i.queue_free()
add_child(load("res://scenes/menu/startMenu/start_menu.tscn").instantiate())