rewired signals and added savemanager and resource saving

This commit is contained in:
Luca 2024-09-26 21:37:19 +02:00
parent 0f5045dc22
commit f694d5c4f8
13 changed files with 138 additions and 87 deletions

20
game.gd
View file

@ -10,14 +10,17 @@ func _ready() -> void:
if skip_menu == true:
UI.show_ingame_controls(!skip_menu)
UI.show_main_menu(!skip_menu)
_on_ui_on_new_game_started()
start_new_game()
return
# On start of the game, the main menu is shown
UI.connect("on_new_game_started", start_new_game)
UI.connect("on_game_continued", continue_game)
UI.show_main_menu()
# this event comes from the MainMenu Node in the UI
func _on_ui_on_new_game_started() -> void:
func start_new_game() -> void:
var world = preload("res://worlds/debug_level.tscn").instantiate()
UI.show_ingame_controls()
@ -27,8 +30,17 @@ func _on_ui_on_new_game_started() -> void:
# Add the starting player to the starting world
var player = preload("res://entities/player/player.tscn").instantiate()
world.add_child(player)
# Give the player a monster
var monster = MonsterData.new()
monster.set_data("debuggy")
SaveManager.current_save.party.push_back(monster)
# Update the UI once
UI.update()
# event comes from the MainMenu Node in the UI
func _on_ui_on_game_continued() -> void:
SaveGame.load()
func continue_game() -> void:
SaveManager.load_game()
UI.show_ingame_controls()
UI.update()