49 lines
1.2 KiB
GDScript
49 lines
1.2 KiB
GDScript
extends Control
|
|
|
|
@export var main_menu: Control
|
|
@export var level_select: Control
|
|
@export var first_selection: Control
|
|
@export var level_first_selection: Control
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
first_selection.grab_focus()
|
|
var err = Globals.config.load()
|
|
if err:
|
|
print("Config does not yet exist, skipping load")
|
|
else:
|
|
print("Config loaded successfully")
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
pass
|
|
|
|
|
|
func _on_start_button_pressed():
|
|
# get_tree().change_scene("res://game/main.tscn")
|
|
main_menu.hide()
|
|
level_select.show()
|
|
level_first_selection.grab_focus()
|
|
|
|
|
|
func _on_options_button_pressed():
|
|
var options = load("res://src/gui/menu/options.tscn").instantiate()
|
|
get_parent().add_child((options))
|
|
options.last_menu = main_menu
|
|
main_menu.hide()
|
|
|
|
func _on_quit_button_pressed():
|
|
get_tree().quit()
|
|
|
|
func _on_back_button_pressed():
|
|
level_select.hide()
|
|
main_menu.show()
|
|
first_selection.grab_focus()
|
|
|
|
func _on_level_button_pressed(level:int):
|
|
load_level("res://src/game/levels/level_%s.tscn" % level)
|
|
|
|
func load_level(path: String):
|
|
get_tree().change_scene_to_file(path)
|