file select and file creation, menus glued together

This commit is contained in:
Haze Weathers 2023-07-20 18:19:20 -04:00
parent 13708b4046
commit f7496c5e6f
18 changed files with 754 additions and 47 deletions

View file

@ -142,11 +142,15 @@ var current_file: SaveFile = null
func _ready() -> void:
# TODO: make load last played file
current_file = load_file("user://file1.pr")
Game.difficulty = current_file.difficulty
current_file = load_file("user://file%d.pr" % Options.last_file)
if current_file:
Game.difficulty = current_file.difficulty
## shortcut for loading a save file from specific path
func load_file(path: String) -> SaveFile:
var file = SaveFile.new(path)
file.load_from_file()
return file
if File.new().file_exists(path):
var file = SaveFile.new(path)
file.load_from_file()
return file
else:
return null