Game data save/load, profile autoload

This commit is contained in:
gotfishmakesticks 2023-11-12 21:06:52 +03:00
commit cf4687350d
7 changed files with 48 additions and 4 deletions

View file

@ -14,6 +14,8 @@ var texts = {
"Profiles" : "Profiles",
"Credits" : "Credits",
"Back" : "Back",
"Play" : "Play",
"LoadGame" : "Load from Profile",
"Null" : Game.gameversion
}
@ -35,7 +37,10 @@ func _on_button_up():
"LoadProfileConfirm":
var profile_name = controller.input.text
var profile_meta = Game.profile_legit_check(Game.profile_load(profile_name))
Game.profile = Profile.create(profile_meta)
if profile_meta != {}:
Game.profile.profile_meta['meta']['last_profile'] = profile_name
Game.profile_save(get_tree().current_scene)
Game.profile = Profile.create(profile_meta)
var format = {"profile": Game.profile.profile_meta['meta']['profile_name']}
controller.profile_status.text = "Current profile: [{profile}]".format(format)
"DeleteProfile":
@ -56,6 +61,12 @@ func _on_button_up():
controller.change_menu(2)
"LoadProfile":
controller.change_menu(3)
"Play":
controller.change_menu(4)
"LoadGame":
if Game.profile.profile_meta.has('game'):
Game.profile.profile_meta['game_load'] = true
get_tree().change_scene_to_file("res://scenes/Space.tscn")
func change_name():
visible = id != "Null"