Deal 'em up...
I''m designing a card game and I have a couple of questions about how I should proceed.
1. In this card game I want to have the ability to have four players plus the dealer. I know I will have a class named "PLAYER" or something close to that, but how do I keep track of which instance of the class I''m using.
I thought about an array of class objects, but that seems cumbersome, there must be something I''m overlooking that will allow me to have multiple instances of a class. (Would that be the key instance?)
2. I have 52 cards I must keep track of and this seems more like an array solution, but when I display the cards should I get the corresponding bitmap for each card, or use my 2ddraw talents and draw each card as I need them?
TIA
Triston
All the world''s a stage...and I seem to fall off quite a bit.
All the world's a stage...and I seem to fall off quite a bit.
1. Yes. You want to create a class "Player" and then create an array of them "Player ThePlayers[4]". If you want to be able to have less than four players, I would have a variable to keep track of how many players are being used, and just ignore the unused spots in the array. That''s easier than worrying about dynamically allocating them for such a small array.
2. What you can do, is when you want to draw a card first see if it is from 2-10. If it is, draw text for the number, then draw the symbol of the suit according to the number in the pattern it should apper on the card (like in an X for 5, one on top of the other for 2). For face cards, draw the letter as text, then instead of drawing the pattern of suit symbols, draw a picture in the middle.
Hopefully that''s understandable and helpful.
tj963
2. What you can do, is when you want to draw a card first see if it is from 2-10. If it is, draw text for the number, then draw the symbol of the suit according to the number in the pattern it should apper on the card (like in an X for 5, one on top of the other for 2). For face cards, draw the letter as text, then instead of drawing the pattern of suit symbols, draw a picture in the middle.
Hopefully that''s understandable and helpful.
tj963
tj963
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement