Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Plenty of users ask for poker or blackjack examples - yet I've never been able to find one that I could adapt or learn from.

    Every so often I try making my own engine - yet I always hit a brick wall.

    Anyone up for the challenge of providing an open source example? Here's my latest attempt yet it's not even close to being an useable engine. Please login to see this attachment.

  • I've no time to make an example, but what I would do is represent the deck as an Array. A value of 1-13 could be A2345678910JQK for one suit; 14-26 would be the next suit, etc. A value of 0 would mean the card has been removed from the deck. You could scramble the values in this array to make a "shuffled" deck, then just draw cards by iterating through it.

    Now with your actives, only have one Card object (rather than all separate as in your example), and just make its frames correspond to the values used to represent it in the Array. When you draw a card from the array, set the frame of the active to its corresponding value. In order to apply rules to the game, you'll likely need to be on point with your object selection (I'm sure there are tutorials you can find about it).

    Please login to see this link. (Indie games and Fusion resources)
    For freelance inquiries please email admin at ultimatewalrus.com

  • I've always found the easiest way to deal with cards is to just use a list object... you can add a card on each line of the list and then use Random() to grab a line from the list randomly and you can remove the line to take it out of the "deck". You basically just treat the list like a card deck and it works surprisingly well. Super simple to understand as well, and no need for trying to figure out how to keep track of what cards are in the deck with arrays and loops and iteration and whatnot.

    The comment about putting all the cards in one image and making the frames represent the different cards is good though. That's how I'd go about it.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • Blackjack/21 doesn't really require that you add a deck to a list. If you've ever been to a casino you'll notice that the dealer doesn't directly reuse the cards that have been played. The used cards then get discarded and replacement cards come preshuffled ready for them to load into the card dispenser and that the deck is made up of many half decks. So it is completely possible to have more than 4 of any card on the table at one time. This actually simplifies the code for blackjack. You just need to ensure that you use a seeded random number generator because Random() is not random enough for something like blackjack.

  • I've done a deck to a list and it's slow as hell with 6 decks. I recommend you consider an extension as it is instantaneous. I have Windows/iOS/Android code for a single deck. Did you need more? Cards are represented as integers 1-52 where 1-13 is Ace to King and the deck is in alpha suite order Clubs, Diamonds, Hearts, Spades.

  • But as I said there is no need for a deck. Just randomize a number. Then have that number represent the cards value and suit. ie RNG value (again remember to use a seeded RNG) either a value between 0-51 or MOD a high randomized value by 52. Then divide that value by 13 to get its suit. for example
    Suits: 0 = Clubs, 1 = Diamonds, 2 = Hearts, 3 = Spades
    Random number: 36599513
    Card = 36599513 MOD 52 = 41
    Value = 41 MOD 13 = 2
    Suit = 41 / 13 = 3

    Result = 2 of Spades

    *RNG = Random Number Generator.

  • Depending on what platform support you're looking for, there is an extension created by Eliyahu called Deck of Cards that was designed to handle the deck functions.

    For a list of my achievements, hit up Please login to see this link..com/
    Unless you want to party, then go to Please login to see this link.

  • Deck of cards is a good option, it's a good extension but it's PC only.

    If you want the game to be cross-platform, unless Eliyahu is going to port it to the other platforms, you're better off just learning how to do it with basic built-in events.

    Game Launcher Creator V3 - Please login to see this link.
    Bespoke Software Development - Please login to see this link.
    Learn Clickteam Fusion 2.5 - Please login to see this link.

    Danny // Clickteam

  • Thanks Danny, I was after something that would work for IOS and android. I have almost got a blackjack game up and running - the engine is working fine. I just used some counters and alterable values to check cards and used Marv's random card example. It's taken a while, I was just hoping to speed it up.

    Thanks for all the suggestions from other users to use an array, yet I couldn't get my head around it. My code is probably twice as long as needed - yet it works. Once it looks polished I'll post a link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!