-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData.gd
More file actions
69 lines (55 loc) · 1.49 KB
/
Copy pathData.gd
File metadata and controls
69 lines (55 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
extends Node
var Translator
var Properties
var Permissions
var NextScene
var LandingInfo
var file
var content : Dictionary
var CurrentScene : String
var Map : Dictionary
var Inventory : Dictionary
var Position : Vector2
var Enemies : Dictionary
func _ready():
file = File.new()
file.open("res://Data/Translator.json", File.READ)
var test_json_conv = JSON.new()
test_json_conv.parse(file.get_as_text()).result
Translator = test_json_conv.get_data()
file.close()
file = File.new()
file.open("res://Data/Properties.json", File.READ)
var test_json_conv = JSON.new()
test_json_conv.parse(file.get_as_text()).result
Properties = test_json_conv.get_data()
file.close()
file = File.new()
file.open("res://Data/Permissions.json", File.READ)
var test_json_conv = JSON.new()
test_json_conv.parse(file.get_as_text()).result
Permissions = test_json_conv.get_data()
file.close()
func Load():
file = File.new()
file.open("user://Save.sc", File.READ)
var content : Dictionary = file.get_var()
file.close()
LandingInfo = content["LandingInfo"]
Map = content["Map"]
Position = content["Position"]
Inventory = content["Inventory"]
Enemies = content["Enemies"]
content = {}
func Save(Scene):
if Scene == "Space":
LandingInfo["Planet"] = "Space"
content["LandingInfo"] = LandingInfo
content["Map"] = Map
content["Position"] = Position
content["Inventory"] = Inventory
content["Enemies"] = Enemies
file = File.new()
file.open("user://Save.sc", File.WRITE)
file.store_var(content)
file.close()