Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Castor1010 |
Hello everyone
im following this tutorial: https://www.youtube.com/watch?v=g1x8ct2Slok&t=159s
this is my code:
extends Node
var item_data: Dictionary
func _ready():
item_data = LoadData(“res://text/ItemData.json”)
func LoadData(file_path):
var json_data
var file_data = File.new()
file_data.open(file_path, File.READ)
json_data = JSON.parse(file_data.get_as_text())
file_data.close()
return json_data.result
and this is the ItemData.json file:
{
“Appel”: {
“ItemCategory”: “Food”,
“StackSize”: 60,
“AddHealth”: 10,
“Description”: “Food is always good”
},
“Stick”: {
“ItemCategory”: “Nature”,
“StackSize”: 60,
“Description”: “Its just a stick… AND YOU CAN CRAFT WITH IT”
}
}