Guys, i'm new in Godot, can anyone help me with my save game system? Also, my english is very poor, but i'll try

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rayayw

Okay, so, this is my script now:
extends Node

const SAVE_PATH = “res://save_game.json”

Escreve o arquivo de save
func save_game():
#nicializa o arquivo //create the file
var file =“res://save_game.sav”, File.WRITE)

Salva o arquivo //save the file
file.store_line(to_json( // is a function that returns a library

func load_game():
# Open existing file
var file =“res://save_game.sav”, File.READ)

Get the data
var data = {}
data = parse_json(file.get_line())

So, now i want to get the content in this data library and put into my Player_variables class attributes
PS: Player_variables is a singleton with, duh, my player status

:bust_in_silhouette: Reply From: radubolovan

-Make a “Playervariables.load(data)” function and call it with the data from the file.
-Do in Playervariables.load what you did in, but in reverse. Assuming that in the you took the variables’ values and store them in the data, in the Playervariables.load, set the variables from the data.