[PLUGIN] Custom Deck

This forum is currently in read-only mode.
From the Asset Store
Introducing a fully decked out, sinister collection of dark, flavorful music production loops, Ghost Loops.
  • Hey everyone, I'd been fiddling with Construct Classic for a few days when I decided to make a plugin for it called Custom Deck.

    The Custom Deck plug-in allows you to add any deck of cards to your games. These decks can include but are not limited to Tarot decks, collectible trading cards, cards that come with board games, and whatever else you can imagine. Decks can have as many cards as you want, and the cards can be increased or decreased at runtime. Cards need not be unique, so your decks can have several cards of the same type. You can also change the cards at runtime in much the same way that Magic: The Gathering players can customize their decks before duels.

    You can download the plugin here. The RAR file contains the plugin, a demo CAP file, and a three-page manual.

    Please feel free to post your feedback in this thread.

  • Very cool, looking forward to trying this out =D

  • I've been addicted to a special idea of a collectable card game, but never made progress. I just downloaded your plugin in the hope it might make a lot of things easier. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • The demo file that I uploaded doesn't really have much in the way of bells and whistles. All the outputs are in numeric text, which isn't the way one would represent cards in a video game.

    Just now, I figured out how to output the cards as images. (What can I say? I've only been playing with Construct Classic for less than a week.) For those who may be interested, here's a brief explanation on how to do it:

    1. Add sprites for each of your cards. Ideally, they should all be the same size and have unique names. Make sure your sprites are not on the visible area of your layout. Hence, to represent a full deck of 52 playing cards, you will need 52 sprites, one for each card.
    2. Optional step: Create an object folder and put all your card sprites in it. This is just to keep from cluttering the Object panel.
    3. Click any of your card sprites to select it. In the Properties panel (the one on the far left of the screen), expand Groups/Families then click the word "Add" beside "New Family." This will cause a small window named "Construct: New family" to appear. Choose an appropriate family that you're sure you won't use for any other purpose then click the OK button. (For my project, I chose the Blue family.)
    4. In the Project panel (the one on the far right of the screen), right-click the name of your application then click "Manage families" on the context-sensitive menu. A dialog box named "Construct: Family Manager" will appear. Click the name of the family that you assigned to your card sprite then click the Add button. Add all the remaining card sprites to this family. Click the Close button when done.
    5. Insert the following objects in your layout: a custom deck (from my plugin), an array, and a button. The button will be for dealing cards from the deck, so set an appropriate text for it. Change the "Width (X)" property of the array to be equal to the number of unique cards that your custom deck will have.
    6. Create a System::Start of layout event in which you set the size of your custom deck. Within the same event, add the array's "set value at X" action for each of your card sprites' object ID. For example, the first of these actions may be written as "array: Set index 1 to Card01.OID," where Card01 is the name of your first card sprite. Each sprite should be assigned a unique index. If you have 52 unique cards in your custom deck, you will have to add 52 actions of this type.
    7. Add a second event for when the button gets clicked. For this event, add a "Reset Deck" action for the custom deck.
    8. To the second event, add a "System::For each object" sub-event, where the object is the family of sprite cards that you assigned earlier. Set a destroy action for this family. This will clear any cards that may have already been placed on the layout.
    9. Add a "System::For" sub-event to the second event. The loop should go a number of times equal to the number of cards you want to draw. Add a "System::Create object by name" action to this event, where the parameters are the object ID returned by the array at the index returned by a call to "Get random card" from the custom deck, as well as the X and Y coordinates of the card sprite's position. (Quite a mouthful, I know.) In other words, you can add something like this: System: Create object array(Custom Deck.RandomCard) on layer 1 at (50+LoopIndex*93,82)
    10. Run your layout to see how it goes.

    Would anyone be interested if I were to upload a sample CAP file?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Nice plugin.A sample cap file would be most welcome. <img src="smileys/smiley2.gif" border="0" align="middle" />

  • My sample CAP file demonstrating the use of card sprites with my Custom Deck plugin can be downloaded here.

  • Thank you <img src="smileys/smiley4.gif" border="0" align="middle" />

  • This plugin also doesn't help me with my idea. I hoped for a plugin that not only manages a deck, but several decks plus the stack. Also the card's type may be the same, but its strength may vary. For example, the card "mighty warlock" may exist with an attack of 10 or 12. Both cards would have the same ID, but a different tag. Giving every variant of "mighty warlock" a different ID would break the real existing number of cards.

    Would it be possible to enhance the plugin in such a way?

  • Tulamide, I might be able to help, but I need more info. Under what conditions may a card's strength change?

    For example, I've seen some games where a character card's strength is boosted by having equipment cards stacked with it. In other games, putting counters on a card in play indicates that its strength is boosted. Another instance of strength change is when a particular spell card is played, which changes the strength of certain units in play.

    For your game, are your rules similar to the above examples?

  • I sent you a pm <img src="smileys/smiley1.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)