Hello!
I am working on a port of my game to Android, I was wondering if anyone knew of a way to save to Android as I could not find a way to find a directory. My problem is that for example on Windows you can call for a file with file_exists("user://savegame.save") If you know of a directory like this for Android please tell me. Thank you!
Here is my code
func save():
var save_dict = {
"highscore":beststreak
}
return save_dict
func save_game():
if PlayerVars.mobile == false:
var save_game = File.new()
save_game.open("user://savegame.save", File.WRITE)
save_game.store_line(to_json(save()))
save_game.close()
func load_game():
if PlayerVars.mobile == false:
var save_game = File.new()
if not save_game.file_exists("user://savegame.save"):
print("Error! We Don't Have A Save File To Load")
return
save_game.open("user://savegame.save", File.READ)
var current_line = parse_json(save_game.get_line())
beststreak = current_line["highscore"]
save_game.close()