Here is the fix. I’m not sure what happened to the block comments, but once you untangle them hopefully they’ll help you understand the blocks better. If you got more questions, feel free to ask!
I will probably make some changes to make card attributes easier to understand, and create additional blocks that make card attributes feel more like sprite variables (which they absolutely are).
Hello @sylvancircle! I need help with something. I am creating an UNO game, and I wonder, how do I make the game detect when the symbol in one card matches with the card in the pile?
Press B to flip the cards
The Solitaire example has a check like this for stacking cards (where the number must be incremental and opposite color to stack). You can see it here, in the check for allowing a picked up card stack to add to a tableau:
The playing cards that comes with card kit has preset Rank (number 1-13), Suit (string “clubs” “diamonds” “hearts” “spades”), and SuitColor (number 15 for black and 2 for red) attributes. You can compare either Suit or SuitColor depending on your needs.
hii, i absolutely love this extension! super well made. i’m using it to make a demake of Balatro!
i know i’m late to the forum, but i was wondering if there was a way to move the cursor to a neighboring card without input from a player. i can’t seem to work this out, but it seems very simple in concept. is there any way to do this?
Yes, you can move the cursor with code (it can point to any Sprite, not just cards), but skipping a card isn’t trivial. The trick is to get the cards array from the current card container, figuring out the index of the cursor card, then setting the cursor to point to a different card by calculating the index of the new card to point to:
This code skips the cursor away from any even cards in your hand. It is not foul-proof because it doesn’t account for running past the first/last card, and if your entire hand is even the cursor would be stuck infinitely skipping.
It’ll be a lot of work, but a Balatro demake to some degree can definitely be done off the Card Kit extension. Feel free to ask if you have any other questions, or run into any other trouble!
A brief explanation of the various types of card containers:
A spread is a single line of cards. You usually want to use this for player hands, or the battlefield in Magic, or the individual stacks in solitare (as you can see from the example).
A deck is a single stack of cards where only the top card is shown and the rest of the cards are always shown face down. When you use the default create deck of playing cards, it is actually putting 52 standard playing cards into a deck container.
A pile is like a deck, except every card below the first is treated as face up. This matters because when the cards stack, you’d see the edge of face up cards in the stack instead of the back like you’d see in a deck.
A grid can act like a spread except it is more rigid - you must give it a fixed row/column size, and cards beyond the grid size are hidden behind scroll bars. You can see an example grid in the memory game.
Fair warning for hard times ahead: the extension was not designed with mouse controls in mind. While individual cards are sprites, I couldn’t get the Card sprite kind added properly to the sprite kind list so there’s no way to properly detect when you’ve clicked on a card. You will need to rely on the built in D-pad based controls to select and use cards, since I don’t have any plans to update the extension in the near future.
On second thought, I was overly pessimistic about not being able to manipulate the cards with the mouse cursor. You can use the array of container cards block to pull up all the cards in a container and then check each card individually to see if the cursor is touching them.
To look through the cards in a container, use the array of container cards block:
My previous example that checks for even cards actually used this block (it’s that rather long line of orange blocks), but here is a cleaner example (pressing B will make all the even cards in myHand say !):