diff options
Diffstat (limited to 'scripts/items.gd')
| -rw-r--r-- | scripts/items.gd | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/scripts/items.gd b/scripts/items.gd new file mode 100644 index 0000000..a6ca8be --- /dev/null +++ b/scripts/items.gd @@ -0,0 +1,17 @@ +extends Object + +var data = null + +func _init(): + var file = File.new() + file.open("res://assets/shop.json", File.READ) + var content = file.get_as_text() + file.close() + self.data = parse_json(content) + +func get(id): + for cat in self.data.keys(): + for item in self.data[cat]: + if item["id"] == id: + return item + return null
\ No newline at end of file |
