So this is kind of what I use for loading/saving to a save file:
extends Node
func save_data(save_path : String, data : Dictionary) -> void:
var data_string = JSON.print(data)
var file = File.new()
var json_error = validate_json(data_string)
if json_error:
print_debug("JSON IS NOT VALID FOR: " + data_string)
print_debug("error: " + json_error)
return
file.open(save_path, file.WRITE)
file.store_string(data_string)
file.close()
func load_data(save_path : String = "user://game.dat"):
var file : File = File.new()
if not file.file_exists(save_path):
print_debug('file [%s] does not exist; creating' % save_path)
save_data(save_path, {})
file.open(save_path, file.READ)
var json : String = file.get_as_text()
var data : Dictionary = parse_json(json)
file.close()
return data
What I think you should do is just save something like {"last_scene_path": "res://path/to/scene.tscn"}
whenever you load a new scene. Then, when you press the continue button, do something like:
var game_data = load_data()
some_method_to_change_scene(game_data.last_scene_path)