How to combine packs/decks of cards using tables...

Why hello there! I have a question that I couldn't find an answer to and thought I'd throw it out to the community.
Here's the gist. Let's say I've got a game where there's a standard deck/pack of game cards. I understand how to do this with tables. Even know how to randomly select cards and discard the ones used (via tables). Cake. But here's where I get lost. Let's say users can purchase expansion decks/packs. To keep it simple, let's say there are 4 expansion decks.
And let's say the user purchases 3 of them (the number here is not important).
If I want the expansion cards to be combined into the standard deck/pack during gameplay and be able to pull cards randomly, and discard the cards unused- how would I go about doing that? (<--- that's my question)

I can't tell if this is something that should be done across multiple tables and then have some operation that combines them and saves them. Though I'm still lost on how the table would know how to insert another table and how it would know to put it below itself. This would have to apply to whichever decks/packs they purchase.

Anyways, any help would be greatly appreciated.
Many thanks!

Best Answer

  • gamesfuagamesfua Posts: 723
    Accepted Answer

    tatiang thank you very much for your help! That's actually not a bad idea! I agree it's not perfect but it does seem like it could work. Thanks again for your help!

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2018

    I would keep everything in a single table. It's probably best to include all of the standard cards' and all of the expansion deck cards' info in the table. Have a column with a boolean for whether or not that particular card is active. [Edit: set all standard cards' booleans to true.] When an expansion pack is purchased, set that boolean to true for those cards (rows).

    Then when selecting a card (row) at random, if a row is chosen with the boolean value false, ignore it and re-select a new card.

    It's not a perfect system but it's a lot better than using multiple tables or trying to copy information from one table into an existing (non-empty) table.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.