This repository has been archived on 2024-07-02. You can view files and clone it, but cannot push or open issues or pull requests.
HoppyEaster/Scripts/SaveSystem/GameDataSaver.gd

32 lines
577 B
GDScript3
Raw Normal View History

extends Node
const SAVE_FILE : String = "user://SAVEFILE.save"
var game_data = {}
func _ready():
load_data()
func load_data():
var file = FileAccess.open(SAVE_FILE, FileAccess.READ)
if file == null:
game_data = {
"display_mode": 0,
"vsync_on": false,
2023-04-09 13:04:49 +00:00
"current_resolution_index": 0,
"master_volume": 0,
"music_volume": 0,
"sfx_volume": 0,
}
save_data()
else:
game_data = file.get_var()
file.close()
pass
func save_data():
var file = FileAccess.open(SAVE_FILE, FileAccess.WRITE)
file.store_var(game_data)
file.flush()
2023-04-09 15:22:06 +00:00
file.close()
pass