Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MyNameIsntBob |
So I’m currently working on creating a card game and stumbled upon the issue that I need to make possibly hundreds of cards for this game, so I was just wondering what the best method would be.
I could go about and create a new game object for each card, but that just seems like the wrong way to do it, (especially because a lot of the cards are going to be similar and I don’t want to recreate the work for each card). So I decided that I’d probably want to have all cards created from a single game object that views a dictionary to decide what it’s properties are. Doing this method I decided it might be easiest to create a JSON file will all of the cards, and just give each card it’s own id.
1: {
“Id”: 1,
“Text”: {
“Body”: “This is the body”,
“Title”: “Title”,
“Cost”: “3”
},
“Image” : {
“Main”: “res://Assets/CardArtTemplate.png”,
“Background”: “res://Assets/Test.jpg”,
}
}
When, however, I try to create this JSON file and import it into the project, it doesn’t seem to work. So I ended up looking into it and people online seem to talk about JSON files as to be used for saving.
Is there a simple way to use a JSON file, or would I need to use a different method to create these cards (possibly have a script that’s just the JSON file)