I made a save and load system but i want to get the values from each slot directly from file
extends Node
const file_path = "res://saves/"
var file_name = "res://saves/slot_00.dat"
var game_data = {}
func save_slot():
var file = File.new()
file.open_encrypted_with_pass(file_name, File.WRITE, "J7Çhri$Tº")
file.store_var(game_data)
file.close()
print(game_data)
func load_slot():
var file = File.new()
if not file.file_exists(file_name):
game_data = {
"health": 0,
}
save_slot()
file.open_encrypted_with_pass(file_name, File.READ, "J7Çhri$Tº")
game_data = file.get_var()
file.close()
print(game_data)
func set_slot(slot):
game_data = {}
file_name = file_path + slot
My code generate a file called "slot01.dat" this file contains var, and my load game screen has four slots, i want to put the informations of "slot01.dat" in their respective labels and the same for "slot02.dat", "slot03.dat" and "slot_04.dat". Detail, i want to take the information directly from files.