summaryrefslogtreecommitdiffstats
path: root/root.gd
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-11-14 22:01:48 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-11-14 22:01:48 +0200
commitd8c3cb5e5421b6daaad792ec4db5cb27e84a8a7d (patch)
treee530b99ebebb675ca9fc4671ae857295731820b8 /root.gd
parentff9374ffce07015720406ae5fcd77bfec12e0d69 (diff)
Experiment with save files
Diffstat (limited to 'root.gd')
-rw-r--r--root.gd13
1 files changed, 12 insertions, 1 deletions
diff --git a/root.gd b/root.gd
index dcb753d..93e40e7 100644
--- a/root.gd
+++ b/root.gd
@@ -2,11 +2,20 @@ class_name Root
extends Node2D
@export var initial_level: PackedScene
+var save_state_path = "user://save_state.cfg"
+var save_state = ConfigFile.new()
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var level = initial_level.instantiate()
add_child(level)
+
+ # Testing
+ save_state.load(save_state_path)
+ print("loaded test_item: ", save_state.get_value("items", "test_item"))
+ save_state.set_value("items", "test_item", true)
+ save_state.save(save_state_path)
+ print(OS.get_data_dir())
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta: float) -> void:
@@ -19,4 +28,6 @@ func change_level(level_name: String):
var next_level = level.instantiate()
add_child(next_level)
-
+
+func save():
+ save_state.save("user://save_state.cfg")