Card game, getting started...

  • Hello,

    I want to create a card game, so I am wondering how I should get started.

    I thought I could create the cards as sprites and put them into a "Cards" family. Each card has the instance variable "value". I would shuffle them with an array of 52.

    Is this a good way to do it, or do you have a better idea?

    How could I implement the Dealer and Player. As a global variable "dealer value" and "player value" does not seem right.

    And what is the best way to hand the cards out? How do I define and assign the cards of the player and the cards of the dealer to determine their card values later on?

    Best Regards,

    Astrosus.

  • I'd create single objects, with different cards as separate animations/frames. You could for example have animation Spades, hearts etc. with cards at frame numbers matching to the cards value. So Spade to would be at animation "Spade" at animation frame 2 and so forts. No need to use any other variables in that case, as you can see the value from animation frame.

    If you decide to use arrays to handle decks and whatever, you should have array for each player(or dealer) that has the cards of that player. Thus checking the cards player has would only be going through that array.

    Hope these random thoughts give you some ideas :)

  • I tried my best to create Blackjack, but it is not working.

    I uploaded the .capx for you.

    The problems:

    • he does not deal the cards, only sometimes on heavy button spamming with left and right click
    • when he deals the cards, the cards are all the same
    • I need a better method on placing the cards in the appropriate place.
    • I need a method to detect the value of the Player and Dealer hand and compare them to set winning conditions

    When the player clicks on "New hand" he gets 2 cards, then the dealer gets 1 card and 1 card upside down. When the player decides to stand, the upside down card should be turned into a random card as well.

    Depending on how many times the player/dealer hits (takes another card) I need to place the card in a appropriate place. I think I need about 6 to 8 card slots for the Player and the Dealer (each), but in the case the player is able to hit more often, the cards should be placed correct too.

    I would really appreciate it, if you could help me to fix the problems.

    Best Regards,

    Astrosus.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anyone, please? <img src="smileys/smiley24.gif" border="0" align="middle" />

  • there's a card deal shuffling capx in the arcade.

  • I can not find it. Why is there no search function for the Arcade? :(

  • I'm on my cell so i can't open you capx but there's an example for solitaire here:

    http://www.scirra.com/forum/solitaire-game-with-construct-2_topic60938_post374424.html#374424

    It should still work. I forget if I commented it but at least it should help a bit.

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