I've never written card games before and am currently coding up a simple card game, I have a deck of cards and they need to be shuffled (done) and then draw from the top deck into a tableau (centre of table) from which the user(s) can pick from.
The only issue is I'm not sure how I can figure out where the cards drawn from the top deck go to.
Let's say the draw deck is drawn at 100,100.
Let's say the tableau starts at 200,200 and can have 6 cards in them.
How do I know where the cards are going to appear on screen within the tableau?
My current thoughts are that we fill the tableau "empty" card objects at set X/Y co-ordinates so that I know without having to do too much programming where the cards should go to.
But I'm not sure if this is the best way to do it because of screen sizes, etc.
ie: Tableau. A card width is 50, and the distance between them is 20
> Card slot #1 = 200,200 (State: Empty)
> Card slot #2 = 270,200 (State: Empty)
> Card slot #3 = 340,200 (State: Empty)
So the first card drawn would animate from 100,100 to 200,200 and change it's state to
The second to 270,200, changing its state
The third to 340,200, changing its state
And so on..
But I'm still unsure if using hard number co-ordinates is really the best way forward, especially if the screen sizes change; or even if there's a better way to animate cards from a draw pile to a tableau.
My question therefore is -- how do I make the computer know where to put cards drawn from a deck of cards to a tableau?