extends Node const HIGHSCORE_FILE_PATH = "highscores.json" func updateHighscore(mapname:String,preset:String,rounds:String,time:float): var highscores=loadHighscoreDict() var lasthighscore=loadHighscore(mapname,preset,rounds) if lasthighscore !=null: if time0: return highscores[mapname][preset][rounds][highscores[mapname].size()-1]["time"] #return last entry else: return null func loadHighscoreDict(): var file = FileAccess.open(HIGHSCORE_FILE_PATH, FileAccess.READ) if file == null: return {} var content = file.get_as_text() return JSON.parse_string(content) func storeHighscoreDict(content:Dictionary): print("Saved Highscorefile:"+str(content)) var file = FileAccess.open(HIGHSCORE_FILE_PATH, FileAccess.WRITE) file.store_string(JSON.stringify(content, "\t"))