Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Deal 'em up...

This topic is 5896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post

Link to post
Share on other sites
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.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!