# Card Game Extension (alpha release)

**URL:** <https://forum.makecode.com/t/card-game-extension-alpha-release/26024>\
**Category:** Arcade\
**Tags:** extension\
**Created:** [January 16, 2024, 10:49pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024 "2024-01-16T22:49:42Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![sylvancircle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sylvancircle/32/15811_2.png) [@sylvancircle](https://forum.makecode.com/u/sylvancircle)\
**Post date:** [November 7, 2025, 6:46am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/41 "2025-11-07T06:46:39Z")

</div>

Currently, you can only have one design for the card’s back. You can change the card back image by using the “set card (back) frame image” block. There are other restrictions placed on card containers: decks are meant to be a stack of face down cards, and piles are meant to be a stack of face up cards. You can flip the top card up/down, but trying to change the facing of the other cards in the stack wouldn’t do anything and might even result in an error. When you move cards from one container to another, you can change the facing of the card at that moment.

By the way, since I thought for quite a bit to come up with the design for a standard UNO deck, I ended up building the full game. You can see a card back change in the CreateUNODesign function.

> **[UNO Example](https://arcade.makecode.com/S39518-71729-16228-22924)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![QWERTYUIOP569](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/qwertyuiop569/32/26161_2.png) [@QWERTYUIOP569](https://forum.makecode.com/u/QWERTYUIOP569)\
**Post date:** [November 13, 2025, 2:20am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/42 "2025-11-13T02:20:43Z")

</div>

How do you pick a card up with the cursor that will move with the cursor?

---

<div class="post-metadata">

**Author:** ![TheEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theearth/32/34579_2.png) [@TheEarth](https://forum.makecode.com/u/TheEarth)\
**Post date:** [November 13, 2025, 4:38am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/43 "2025-11-13T04:38:12Z")

</div>

the card is a sprite so you could put in a game update to move the cards x and y to the cursor sprite

---

<div class="post-metadata">

**Author:** ![sylvancircle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sylvancircle/32/15811_2.png) [@sylvancircle](https://forum.makecode.com/u/sylvancircle)\
**Post date:** [November 13, 2025, 4:38am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/44 "2025-11-13T04:38:19Z")

</div>

It is a little clunky right now, but you can see it being done in the solitaire example. Create a card container and move the cards that need to follow the cursor into that container, then create a “on game update” handler and use the “set container position” block (at the very bottom, under the Customizations category) to set the container’s position to cursor x and y (use the sprite property block and put the special “cursor” sprite variable to extract its properties).

It’s a common enough use case that I’ll probably end up creating a special block for managing this, but for now at least it can be done in some way.

---

<div class="post-metadata">

**Author:** ![QWERTYUIOP569](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/qwertyuiop569/32/26161_2.png) [@QWERTYUIOP569](https://forum.makecode.com/u/QWERTYUIOP569)\
**Post date:** [November 14, 2025, 12:15am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/45 "2025-11-14T00:15:32Z")

</div>

Ok, thanks. Sorry to bug you, but what are the “cursor container” and “cursor card” blocks for?

---

<div class="post-metadata">

**Author:** ![sylvancircle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sylvancircle/32/15811_2.png) [@sylvancircle](https://forum.makecode.com/u/sylvancircle)\
**Post date:** [November 14, 2025, 3:56am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/46 "2025-11-14T03:56:10Z")

</div>

The “cursor card” block is a variable that represents the card the cursor is currently pointing at (using the card extension’s built in cursor navigation). It is usually easier to use the “on button press of card in container” event handler, but occasionally you might want direct access to the cursor card and that block is the way to do it.

Card Containers are data objects for organizing Cards. Think of all the places where cards would go to - the initial deck where all cards come from, each player’s hand, fields where cards can play into, and discard piles after cards are resolved.

Each card container internally contains an array of cards and some inherent properties about how the cards within the container are organized on screen:

- Decks stack all of the cards in its array face down. It’s usually where all the cards are at the start of a game.
- Spreads put all the cards in a line, usually face up to represent an active player hand.
- Grids put the cards into a two dimensional grid. Unlike spreads, grids have a fixed row and column size and you can scroll if there are more cards than what the grid can fit.
- Finally, Piles are like the opposite of Decks - it is another way to stack cards, but they are all face up instead.

---

<div class="post-metadata">

**Author:** ![QWERTYUIOP569](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/qwertyuiop569/32/26161_2.png) [@QWERTYUIOP569](https://forum.makecode.com/u/QWERTYUIOP569)\
**Post date:** [November 17, 2025, 2:40am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/47 "2025-11-17T02:40:14Z")

</div>

Thanks, but what does the “cursor container” do? The “cursor card” is the card the cursor is pointing to, but what about the “cursor container”? Is it the same as “cursor card” but the container it is pointing to; for example, the draw deck as a whole instead of the top card.

Also, how do you check if a card is a specific suit?

Sorry for flooding you with questions, but you have been a great help to my coding,

Regards, QWERTYUIOP569

---

<div class="post-metadata">

**Author:** ![sylvancircle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sylvancircle/32/15811_2.png) [@sylvancircle](https://forum.makecode.com/u/sylvancircle)\
**Post date:** [November 17, 2025, 5:40pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/48 "2025-11-17T17:40:35Z")

</div>

You are correct - the cursor container refers to the card container of the card that the cursor is currently pointing at.

The default card deck has these attributes:

- Rank, a number between 0 (joker) and 13 (11-13 are JQK).
- Suit, a string that is either “spades”, “diamonds”, “clubs”, or “hearts” (those exact words)
- SuitColor, a number that is either 2 (red) or 15 (black).

You can use the “card Suit Attribute text” block to extract that information.

---

<div class="post-metadata">

**Author:** ![TheEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theearth/32/34579_2.png) [@TheEarth](https://forum.makecode.com/u/TheEarth)\
**Post date:** [November 17, 2025, 5:41pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/49 "2025-11-17T17:41:06Z")

</div>

yes it is the entire deck of cards uh in the rank attributes part click rank and there is a dropdown

---

<div class="post-metadata">

**Author:** ![QWERTYUIOP569](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/qwertyuiop569/32/26161_2.png) [@QWERTYUIOP569](https://forum.makecode.com/u/QWERTYUIOP569)\
**Post date:** [November 21, 2025, 3:51am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/50 "2025-11-21T03:51:07Z")

</div>

I’m working on a blackjack game using you extension. So far I need to make the dealer choose between Hit and Stand, without doing the best move every time. I’m skipping double down for now.

---

<div class="post-metadata">

**Author:** ![sylvancircle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sylvancircle/32/15811_2.png) [@sylvancircle](https://forum.makecode.com/u/sylvancircle)\
**Post date:** [November 21, 2025, 7:11pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/51 "2025-11-21T19:11:55Z")

</div>

The dealer’s rules are fixed in blackjack: If their number is 16 or less, they must hit, otherwise they must stand. They can’t really “think” in the way that other players on the table can. The hard part is actually calculating a hand’s number - it will be tricky since J,Q, and K count as 10 and A can be 1 or 11.

I’ll spoiler the answers in case you want to figure it out on your own. For calculating a hand’s number:

assuming `dealerHand` is the card spread container for the dealer’s cards, and `numberTotal` is the number you can use to determine other things at the end of the calculation:

 ![Screenshot 2025-11-21 at 10.51.15 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/5/6/56924636fc4e6c907cec2f67b1afb0181800254c.png)

Two loops are necessary, because you want to calculate the “hard” numbers (numbers that can’t be changed) first before calculating the “soft” A to give them the best chance of using their bigger number, 11.

---

<div class="post-metadata">

**Author:** ![sylvancircle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sylvancircle/32/15811_2.png) [@sylvancircle](https://forum.makecode.com/u/sylvancircle)\
**Post date:** [November 23, 2025, 12:02am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/52 "2025-11-23T00:02:53Z")

</div>

I figured people are eventually going to ask about it, so I might as well get ahead of the game. Here is a starter kit to demake Balatro:

> **[Balatro Demake Example](https://arcade.makecode.com/S25846-68671-33318-89008)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Press B to swap between sorting by rank/suit. It is a bit more hacked together than some of my other examples, some implementations are incorrect (sort by suit doesn’t sort the rank correctly within the suit), some features are missing (can’t move cards or see remaining cards in deck), and obviously everything in the original game outside of the white deck small blind are missing.

---

<div class="post-metadata">

**Author:** ![sylvancircle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sylvancircle/32/15811_2.png) [@sylvancircle](https://forum.makecode.com/u/sylvancircle)\
**Post date:** [November 23, 2025, 12:12am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/53 "2025-11-23T00:12:13Z")

</div>

I just realized that my Blackjack number total code calculates incorrect results in some situations (QAA would count as 22, which is incorrect). To correct the mistake: Always add the hard part of the numbers in the first loop, then add the soft part of the numbers in the second loop if it is safe to do so.

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [November 23, 2025, 10:28pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/54 "2025-11-23T22:28:45Z")

</div>

Woah tysm!!

---

<div class="post-metadata">

**Author:** ![QWERTYUIOP569](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/qwertyuiop569/32/26161_2.png) [@QWERTYUIOP569](https://forum.makecode.com/u/QWERTYUIOP569)\
**Post date:** [November 25, 2025, 6:12am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/55 "2025-11-25T06:12:18Z")

</div>

Thanks for that code, I made a much longer function which is too long to show all of it:

 ![Screenshot 2025-11-25 105334](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/e/2/e257b9fb694b642450e137f1507193a9fd9ca37b.png)

---

<div class="post-metadata">

**Author:** ![QWERTYUIOP569](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/qwertyuiop569/32/26161_2.png) [@QWERTYUIOP569](https://forum.makecode.com/u/QWERTYUIOP569)\
**Post date:** [November 25, 2025, 6:36am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/56 "2025-11-25T06:36:47Z")

</div>

Here is the final blackjack, with Hit, Stand and Dealer playing:

> **[Blackjack](https://arcade.makecode.com/S44367-31624-21579-31664)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I hope you like it!

@QWERTYUIOP569 😉

---

<div class="post-metadata">

**Author:** ![ChimbroDaPro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/chimbrodapro/32/15852_2.png) [@ChimbroDaPro](https://forum.makecode.com/u/ChimbroDaPro)\
**Post date:** [November 25, 2025, 6:16pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/57 "2025-11-25T18:16:55Z")

</div>

LET’S GO GAMBLING!

aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit… aw dangit…

---

<div class="post-metadata">

**Author:** ![QWERTYUIOP569](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/qwertyuiop569/32/26161_2.png) [@QWERTYUIOP569](https://forum.makecode.com/u/QWERTYUIOP569)\
**Post date:** [November 26, 2025, 4:41am UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/58 "2025-11-26T04:41:52Z")

</div>

FYI, it is impossible to win before you grind it tons.😜

---

<div class="post-metadata">

**Author:** ![king\_bob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/king_bob/32/35049_2.png) [@king\_bob](https://forum.makecode.com/u/king_bob)\
**Post date:** [November 26, 2025, 10:41pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/59 "2025-11-26T22:41:49Z")

</div>

I won second try😒

---

<div class="post-metadata">

**Author:** ![TheEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theearth/32/34579_2.png) [@TheEarth](https://forum.makecode.com/u/TheEarth)\
**Post date:** [November 28, 2025, 7:56pm UTC](https://forum.makecode.com/t/card-game-extension-alpha-release/26024/60 "2025-11-28T19:56:29Z")

</div>

yooooo I love balatro

[Previous page](https://forum.makecode.com/t/card-game-extension-alpha-release/26024.md?page=2)

[Next page](https://forum.makecode.com/t/card-game-extension-alpha-release/26024.md?page=4)
