Data model for unlockable card collection
- by Karlos Zafra
My game has a collection of cards (about 64) that are unlocked (one by one) provided that 4 items are collected/gained in the game.
Right now the deck of cards is modeled with a plist file, like this:
<plist>
<dict>
<key>card1</key>
<dict>
<key>available</key>
<true/>
<key>series</key>
<integer>1</integer>
<key>model</key>
<integer>1</integer>
<key>color</key>
<integer>1</integer>
</dict>
<key>card2</key>
<dict>
<key>available</key>
<false/>
<key>series</key>
<integer>1</integer>
<key>model</key>
<integer>1</integer>
<key>color</key>
<integer>2</integer>
</dict>
The value for the key named "available" marks if the item is locked or not. Right now I have to include the data for the items collected by the user, but including that inside the plist looks like too much hassle.
What kind of structure should be more suitable for this? How do you manage a collection of unlockable items like this?