added basic scene manager

This commit is contained in:
Luca 2024-09-27 09:37:12 +02:00
parent f694d5c4f8
commit 2cf0846597
7 changed files with 37 additions and 57 deletions

11
game.gd
View file

@ -10,7 +10,11 @@ func _ready() -> void:
if skip_menu == true:
UI.show_ingame_controls(!skip_menu)
UI.show_main_menu(!skip_menu)
start_new_game()
if SaveManager.save_exists():
continue_game()
else:
start_new_game()
return
# On start of the game, the main menu is shown
@ -21,15 +25,14 @@ func _ready() -> void:
# this event comes from the MainMenu Node in the UI
func start_new_game() -> void:
var world = preload("res://worlds/debug_level.tscn").instantiate()
UI.show_ingame_controls()
# Add the starting world
%CurrentLevel.add_child(world)
SceneManager.set_world("res://worlds/debug_level.tscn")
# Add the starting player to the starting world
var player = preload("res://entities/player/player.tscn").instantiate()
world.add_child(player)
SceneManager.current_world.add_child(player)
# Give the player a monster
var monster = MonsterData.new()