Data model for unlockable card collection
Posted
by
Karlos Zafra
on Game Development
See other posts from Game Development
or by Karlos Zafra
Published on 2012-10-23T19:53:00Z
Indexed on
2012/10/23
23:20 UTC
Read the original article
Hit count: 146
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?
© Game Development or respective owner