Best way to manage a deck of cards with various properties?

Recently I’ve been playing around with Corona SDK in the hopes of creating a deck building card game similar to Dominion.

Starting from a poker game tutorial, I’ve gotten my app to the point where I have a deck that starts with 10 cards, deals 5 at a time, then cycles them through a discard pile and back into the draw deck properly.

My question is how do I best store the information about the cards so that when I access them, they have all the various properties that effect how the game plays?

Right now I’m just storing cards as PNG names, and running a display.newImage function on the card’s name when it enters the play area.

I’d like to get to the point where my cards have a bunch of attributes assigned to them, something like this:

Cards["copper"] = {name="Copper", gold=1,buys=0,actions=0, image="copper.png"}

Then once I access them later, I’d like to do something like this:

display.newImage(Cards["copper"].image)

Hopefully this makes sense.  

That should work for you.

Rob

Ok thanks.  I thought it wasn’t the best way to create a card as I kept getting some errors trying to add Event Listeners.  I finally figured out what was causing the errors so these card tables are working fine so far, thanks!

That should work for you.

Rob

Ok thanks.  I thought it wasn’t the best way to create a card as I kept getting some errors trying to add Event Listeners.  I finally figured out what was causing the errors so these card tables are working fine so far, thanks!