mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Created an empty project, for the team to work from; in regards to making the new toolset
This commit is contained in:
@ -1,22 +1,20 @@
|
||||
extends Node
|
||||
|
||||
|
||||
const save_file = "user://save_file.json"
|
||||
const SAVEGAME = "user://Savegame.json"
|
||||
|
||||
var save_data = {}
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
save_data = get_data()
|
||||
|
||||
|
||||
func get_data():
|
||||
var file = File.new()
|
||||
|
||||
if not file.file_exists(save_file):
|
||||
save_data = {"player_name": "Unnamed"}
|
||||
if not file.file_exists(SAVEGAME):
|
||||
save_data = {"Player_name": "Unnamed"}
|
||||
save_game()
|
||||
file.open(save_file, File.READ)
|
||||
file.open(SAVEGAME, File.READ)
|
||||
var content = file.get_as_text()
|
||||
var data = parse_json(content)
|
||||
save_data = data
|
||||
@ -25,5 +23,6 @@ func get_data():
|
||||
|
||||
func save_game():
|
||||
var save_game = File.new()
|
||||
save_game.open(save_file, File.WRITE)
|
||||
save_game.open(SAVEGAME, File.WRITE)
|
||||
save_game.store_line(to_json(save_data))
|
||||
|
||||
|
Reference in New Issue
Block a user