Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Konrato |
func save_game():
var save_game: File = get_file(true)
var data: Dictionary = {
“PlayerSelect”: Game.PlayerSelect,
“FirstLaunch”: Game.FirstLaunch,
}
save_game.store_line(to_json(data))
save_game.close()
func load_game():
var save_game: File = get_file(false)
if not save_game:
return
while not save_game.eof_reached():
var current_line = parse_json(save_game.get_line())
if current_line:
Game.PlayerSelect = current_line[“PlayerSelect”]
Game.FirstLaunch = current_line[“FirstLaunch”]
save_game.close()