Using BitmapData to manage a deck of cards

December 28th update: 2nd part online

I have already published a tutorial about BitmapData in the post Shuffle an image with BitmapData, but this time I want to show you how to manage a deck of cards using BitmapData.

Managing a deck of cards is very useful because there are tons of card games you can publish once you have a deck of cards in your library.

The first thing you need is an image with all cards like this one:

Deck of cards

The image is scaled down for blogging reasons, but you can view/download it at its original size here.

Now, with the same method seen in Shuffle an image with BitmapData, I’ll cut off all cards starting from the original image.

I am publishing some raw actionscript because this is just a prototype, but a full tutorial will come shortly.

The prototype is about the simplest card game ever: you draw a card and have to say if the next card will be higher on lower than the card you have on the table.

Being a prototype it’s not complete yet, but I want to share this code to you.

and the result is…

I think simple and stupid games like this one can have a good replay value if I provide a high score table like in Christmas Couples, another simple game that entered in the “million games played” club.

But I will talk about it in the next post about the experiment, meanwhile take the source code.

Read 2nd part

  • David

    this is amazing, can’t wait for the tutorial!

    thanks for all the help you’ve given!

  • damn you got 1.000.000+ on christmas couples :o.
    lucky you ^^

  • Good Idea :D!

  • nice.
    ^_^

  • RJ

    Interesting,how’s Tileball going?

  • Lol I bet you got most of those plays on Christmas Couples from Mindjolt.com

  • does this still work with the new flash version?