Godot Version
4.2.2
Question
Hello everyone, I made a save system in my game through a config file (I don’t know if this is effective)
and I started implementing a new game button, it should erase saved data and reset everything to standard values. Tell me how to do this because… I specified config.clear but it did not produce any results
I thought about doing it so that the file would be completely deleted from the user folder, but I also don’t know how to write it
extends Node
@onready var player_scene = “res://Scene/player.tscn”
var config
var path_to_save_file := “user://game.cfg”
var section_player := “player”
var section_worl := “worl”
var section_dialog := “dialog”
var save_scene : NodePath
var ring_find : bool
var dialog_ferst_lesnik : bool
func save_game():
config.set_value(section_worl, “save_scene”, save_scene)
config.set_value(section_worl, “ring_find”, ring_find)
config.set_value(section_dialog, “dialog_first_les”, dialog_ferst_lesnik)
config.save(path_to_save_file)
func load_game():
config = ConfigFile.new()
config.load(path_to_save_file)
save_scene = config.get_value(section_worl, “save_scene”, “res://Scene/map/forest.tscn”)
ring_find = config.get_value(section_worl, “ring_find”, false)
dialog_ferst_lesnik = config.get_value(section_dialog, “dialog_first_les”, false)
func new_game():
pass