25 lines
705 B
GDScript3
25 lines
705 B
GDScript3
|
extends Node2D
|
||
|
|
||
|
@export var settings : Dictionary = {"checkpoint"="","LoadSave"=false}
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
if FileAccess.file_exists("user://settings"):
|
||
|
var filer = FileAccess.open("user://settings",FileAccess.READ)
|
||
|
var tempson = JSON.new()
|
||
|
tempson.parse(filer.get_as_text())
|
||
|
settings = tempson.get_data()
|
||
|
else:
|
||
|
writesave()
|
||
|
|
||
|
|
||
|
func writesave():
|
||
|
var filer = FileAccess.open("user://settings", FileAccess.WRITE)
|
||
|
filer.store_string(JSON.stringify(settings))
|
||
|
|
||
|
func set_setting(namer,value):
|
||
|
settings[namer] = value
|
||
|
writesave()
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
func _process(delta):
|
||
|
pass
|