Playing Cards Resources


  • Posts: 1654

Ginge on the discord chat made a Cards game. He gave permission to post this here.

Download Cards Stencyl file

His discord post:


The code contains:
- a deck of cards (images from imported as distinct animations on a single actor
- code to set up a Deck as a list and generate the 52 actors
- a shuffle function
- the ability to click and drag cards around the screen
- the ability to flip a card (or all cards) over
- and some Debug codes:
     - Space spreads the cards out to view them all based on their order in the Deck list
     - Enter triggers the "flip" event in all cards
     - Tab sends all the cards to a stack in the top left corner and flips them facedown
     - Up shuffles the deck again.
     - Note: If you press Up followed by Space, the cards will reorganize
                   themselves to the new shuffle
Cards keep track of their suit and their value. This allows the code to switch between the facedown animation and their correct faceup animation. Additionally, that would be useful as separate Attributes for games such as Solitaire, War, etc when you need to compare values
Future things to add:
- "Piles" as a set of facedown cards
- a "Draw" function that takes the top card of a Pile. It can either go to a display spot on the table (a la Texas Hold'em Poker or Solitaire) or into a "Hand" list
- a "Stack" of cards that moves together. If you grab at one card, it will drag all cards stacked on top of it with you, but leave the ones behind that card.
- Might add the option for the Deck to actually contain multiple copies of the full deck of cards as some games call for 2-4 decks to be mixed together.
Some Card Resources:

Poker Extension
Cards question
Cards game by LIBERADO
drag drop 1 actor

Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.