Deck of cards

0 favourites
  • 3 posts
From the Asset Store
Template for trading card game, fully documented in comments and video
  • I want to have two separate decks of custom cards with text instead of standard play cards.

    How do I make the deck so when I click it, it randomly picks a card to the side and then the then the next time covers it with another? I am guessing we can go with straight text verses actual graphic card? So would that just be some kind of random array that then subtracts it from the array so it does not pick it again?

    I need a little help here

  • You can use floor(random(52)) which generates a number from 0 to 51, where each number corresponds to a card. You could do this with events or store in an array. On the first drawn card you can set a variable to that number then on second drawn card you compare with that variable and if it matches, run the random command again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can find already implemented examples of sorting arrays and shuffling cards decks for Construct 2, all those still work with Construct 3.

    Be sure to check the tutorials and the How do I FAQ for C2 and you should have the mechanic/logic for a basic deck.

    In your case, yes, I would use an array that would replace an index for a text mention. And have a different array used to determine the shuffled deck order of "cards".

    Unlike a "regular" deck of card, you then wouldn't display a frame from a sprite, but actually display a string from the proper index in the original array.

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