added main menu and can continue from last level

This commit is contained in:
derek
2025-02-24 17:00:41 -06:00
parent a303eb6430
commit c87f22d9e8
14 changed files with 204 additions and 68 deletions

25
scripts/main_menu.gd Normal file
View File

@@ -0,0 +1,25 @@
extends Node
var last_scene
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
SaveLoad.load_persistent_data()
func _on_continue_pressed() -> void:
var level
var load_to_gamemode
if GameGlobals.current_level == null:
level = "res://scenes/HUBWORLD.tscn"
load_to_gamemode = "res://GameModes/hubworld.tres"
else:
level = GameGlobals.current_level
load_to_gamemode = GameGlobals.current_gamemode
get_tree().change_scene_to_file(level)
GameGlobals.loading_gamemode = load(load_to_gamemode)
print("LEVEL : ",GameGlobals.current_level)
func _on_exit_pressed() -> void:
get_tree().quit()