Attention | Topic was automatically imported from the old Question2Answer platform. | |
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 = File.new()
file.open(“res://save_game.sav”, File.WRITE)
Salva o arquivo //save the file
file.store_line(to_json(Player_variables.save())) //player_variables.save is a function that returns a library
file.close()
func load_game():
# Open existing file
var file = File.new()
file.open(“res://save_game.sav”, File.READ)
Get the data
var data = {}
data = parse_json(file.get_line())
print(data)
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