The directory the file is saved is that user://
, which is different depending on platform: Windows, Linux, Web. I know you can use ./
instead, like ./savefile.dat
, to save wherever the game actually is, or ./saves/save1.dat
, but I know it won't work for Web and I don't know if it'll work for Android.
To load, you'll have to do something like this:
var error = file.open_encrypted_with_pass(path, File.READ, "$3GAM$E_/SAvE!1") #Open it in READ mode
defaultData = file.get_var()
file.close()
Do note that anything that isn't in the defaultData struct won't be saved, so you'll want to throw anything else you want to save inside it. Health, items, score, unlocked flags, current map, etc.