added main menu and can continue from last level
This commit is contained in:
25
scripts/main_menu.gd
Normal file
25
scripts/main_menu.gd
Normal 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()
|
||||
Reference in New Issue
Block a user