Randomized an array for a deck of cards

0 favourites
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Glad my tutorial was helpful!

    Depending on how you want the cards to fan out, you might also want to rotate them slightly. This is easiest if the card origin is somewhere on the bottom (either bottom left, right or center.)

  • Hi, where di you found card game pictures? i'd like to put pictures must funny but can't find them...

    thank you all

  • If you want standard 54-card deck, you can find a very nice free vector version at svg-cards.sourceforge.net

    Otherwise, I make my own graphics. You may be able to find someone to help you with that, or find some free graphics on the internet. There are threads about creating art in this forum, too. One of my favorite site for learning to make game art without having to buy expensive tools is 2d game art for developers

  • I just ran across this, and while it seems really nice I think there's a logic flaw. Each time I shuffle the deck and deal out the full deck the last card is always (4 times in a row) the same.

  • > jlouter: the error means the capx needs a specific (custom) plugin to be opened.


    > Apparently those examples were made before Ashley implements dialogs that gives the name of the missing plugin(s).


    > On the first page of this thread you can see this post that links to the required plugin.

    I downloaded the plugin that was listed in that post, and still had an issue with trying to open the capx like jlouter mentioned.

    I also have an alternative shuffle in case anyone would like it:

    <img src="http://i91.photobucket.com/albums/k286/seridras/DealDraw.png" border="0">

    This should address the issue mentioned above for incomplete shuffling.

    This is a Year old. But anyone mind explaining this shuffle to me?

    I see it works, but how come it does not repeat the numbers at some point?

  • Hello all,

    I been away for a long time.

    I have updated this card game demo to fix the shuffle and I took out the plugin Moveto so it will run off stock Construct2.

    Here is the updated file:


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok need help..I'm trying to implement my things over here but when I run it..The cards just loop through all the frames instead of sticking with the desired frame

    capx if that helps


  • That's usually caused by not setting the animation speed to zero.

  • nevermind gotcha..THANK YOU

  • i made a card game... well so far its just one player...

    i made all cards separate and had them in a family "Deck". have a boolean on the card "picked".

    on draw (or on click) pick a random instance of a card where "picked" is false,

    add it to the hand and set it to picked=true

    for the face value, either have a variable (1-13) for each card. just add it to the family, and add it as you go.

    heres my capx https://www.dropbox.com/s/oonwtbo0ajprx ... .capx?dl=0

    as an addendum, your shuffle animation looks sick (pardon the game name, if you kno it you'll forgive me)

  • Sorry to bump a super old thread. But this came up as a top result when I was searching for information regarding card deck in Construct so I should point out.

    The initial capx in the OP does not do a random shuffle of the deck. It's easy to see, mathematically that it's not doing so.

    That event group has a comment at the top explaining two algorithms that are mathematically sound. But the execution does not implement either of them.

    The indexes need to reference "shuffle" for one thing.

    Shuffle a few times and you will notice that many if not most of the cards are in their original spots.

    Overall I found it to be a nice program and as a beginner to construct, found it educational. But the shuffle was not random or mathematically fair.

    Again sorry to bump an old thread, but it needed to be done and was right to do.

  • im trying to make this work for a small 6 card deck for a children's game... so far I've been unsuccessfull...

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