Hi, I’m trying to make a card game similar to 21 (Blackjack) and using the Card system example I tried to make that if the player clicks on a deck, a card in the reserve deck goes in a deck, something like this
but however, when I coded the mentioned in the image above, and when previewing the game, I clicked in the first deck and it looks like this
but this is not what I wanted, I wanted to just put one card in the clicked deck, and on the deck clicked, it puts all the cards in the reserve deck to the clicked deck, so I need a little bit of help on this,
so if someone knows how to make something similar to the first image above, it would be awesome.
I’ve had a look at the example project, and spotted the problem. You’re checking if the mouse point is inside the deck, when it should be checking if the mouse point is inside a Card.
.
This identifies one card.:
All the Card is into the stack of Reserve does is confirm the card is in the Reserve stack.
So you want the top card from the reserve pile/stack to go to lane where you clicked? In that case, I don’t think using the Stack extension is the right option.
Instead, consider using an array of structures (the structure holding the card’s suit and face value as key-value pairs), and then just selecting a random card from the array when there is a mouse click.