Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

Hello Nicholas, Thank you for your feedback!

For remembering the highscore between sessions I use the basic file system of Godot using "user://savegame.save" as path.

var data = {
    "h" : max_height,
    "b" : max_buildings
}
func save_data(data:Dictionary):
     var save_file = FileAccess.open(SaveFile, FileAccess.WRITE)
     save_file.store_line(JSON.stringify(data))

and then for loading:

func load_data():
    if not FileAccess.file_exists(SaveFile):
        return 
    var save_file = FileAccess.open(SaveFile, FileAccess.READ)
    var dict = JSON.parse_string(save_file.get_line())
    max_buildings = dict["b"]
    max_height = dict["h"]

if you have any more questions feel free to ask!

(+1)

I appriciate you taking the time to reply :D

Definately going to be using this in my future projects - cool stuff <3