Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #the SaveSystem Code
- extends Node
- var save_path = "res://save-file.cfg"
- var config = ConfigFile.new()
- var load_response = config.load(save_path)
- var locationCharacter
- func saveValue(section, key):
- config.set_value("Values", "ValueSeven", locationCharacter)
- config.save(save_path)
- func loadValue(section, key):
- locationCharacter = config.get_value("Values", "ValueSeven", locationCharacter)
- #the World Code
- extends Spatial
- func _ready():
- $"/root/SAVEGAME".loadValue("Values", "ValueSeven")
- $Player.translation = $"/root/SAVEGAME".locationCharacter
- $Control/Timer.start()
- func _process(delta):
- $Control/Loc.text = str($"/root/SAVEGAME".locationCharacter)
- if Input.is_action_just_pressed("ui_cancel"):
- SAVEGAME.locationCharacter = $Player.transform.origin
- $"/root/SAVEGAME".saveValue("Values", "ValueSeven")
- get_tree().quit()
- func _on_Timer_timeout():
- SAVEGAME.locationCharacter = $Player.transform.origin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement