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

@ -12,6 +12,10 @@ var menu_id = 0
@onready var input = $Control/Input
func _ready():
var profile_meta = Game.profile_load("")
if profile_meta != {} and profile_meta['meta'].has('last_profile'):
profile_meta = Game.profile_load(profile_meta['meta']['last_profile'])
Game.profile = Profile.create(profile_meta)
change_menu(0)
profile_status.text = "Current profile: [{profile}]".format({"profile": Game.profile.profile_meta['meta']['profile_name']})
@ -19,7 +23,7 @@ func change_menu(id):
input.visible = false
match id:
0: # Main
b1.id = "NewGame"
b1.id = "Play"
b2.id = "Profiles"
b3.id = "Settings"
b4.id = "Credits"
@ -46,6 +50,12 @@ func change_menu(id):
b5.id = "Null"
input.visible = true
input.text = ""
4: # Play Menu
b1.id = "LoadGame"
b2.id = "NewGame"
b3.id = "Back"
b4.id = "Null"
b5.id = "Null"
b1.change_name()
b2.change_name()
b3.change_name()