Using BitmapData to manage a deck of cards – part 2

After a couple of days, the prototype for the management of a card deck is almost complete.

Now I have a full game, you draw a card and have to say if the next card will be higher or lower.

At the moment the prototype has all messages and a game over screen with the score recap.

Now I want to include Kongregate’s highscores API and then I’ll release the complete tutorial.

Meanwhile, here it is the code:

and this is the result

When it’s game over, at the moment you must reload the page to play again. How much did you score?

Download the source code, and wait for the full tut…

  • Marukomu

    Good stuff! This is great for work. I think I’m going rebuild one for my wife.

  • i scored 74 :P

  • RJ

    I’m the recordman:


  • Awesome!!! 69 btw *_^

  • haha 104 winner :D

  • 54! hurray!!

  • limpeh

    This game is not bad, but after some time, it’s quite boring since all you need to do is just ‘guessing’. (btw, I got 91)

  • wooohoo i got 110, :P

  • 105!!!! Gr8

  • Frederik J

    Got 34.. I realized a little “personal bug”, when I play cards, the ace is the highest cards, not the lowest. :-) You need to write a little “Card rules” thing. Also, you need to include what happens when the next card is equal to the first.

    I think games like this, is pretty boring. Not for blaming you game or tuturial which I love, but those games is too simple, and it is random. Here is a little idea.

    It can be fun that when you finish the first game, you’ll get your score in $, and earn money. Then you can by power ups like: you will get a statistic of procents for which the next card would be, you can see the next card, you can decide the next card, and so on…

    Then, if we want to make big things out of it, there can be a multiplayer part, where you play against another player. Then you switch to guess higher or lower, and that person who guess most cards correct wins.

    Anyway: Great game engine, which works incredible, but I would love to see a more advanced game. Keep them coming!

  • To Fred:
    in case of equal cards the game compares in the basis of suit.


  • Custard


  • emanuel

    86 nice game and its not random its probavilities

  • i hope it aint any bad that i used ur sources and changed design,font style and such and gave it out on deviantart?

  • Maniac

    x_x 136
    Awesome game!

  • steve

    i beat u all -134

  • Dan

    Thanks so much for posting this. I have been looking for a simple card shuffle and deal routine for a while now. This is be far the best. Thanks for taking the time to share.

  • John-Michael Glenn

    I made a slightly better deck shuffler on my own, compare it and see how ya’ll like it:

    var deck:Array = new Array(“S1”, “S2”, “S3”, “S4”, “S5”, “S6”, “S7”, “S8”, “S9”, “S10”, “S11”, “S12”, “S13”, “C1”, “C2”, “C3”, “C4”, “C5”, “C6”, “C7”, “C8”, “C9”, “C10”, “C11”, “C12”, “C13”, “D1”, “D2”, “D3”, “D4”, “D5”, “D6”, “D7”, “D8”, “D9”, “D10”, “D11”, “D12”, “D13”, “H1”, “H2”, “H3”, “H4”, “H5”, “H6”, “H7”, “H8”, “H9”, “H10”, “H11”, “H12”, “H13”);
    var deck2:Array = new Array();
    for (var i:Number = 0; i<52; i++) {
    var r:Number = random(deck.length);
    var pick = deck[r];
    var card = deck.splice(r, 1);
    trace(“Shuffled: “+deck2);