Archived

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

Help Me With Class Please?!

This topic is 5624 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 really suck at making an RTS-engine... No, I dont actually, but Im stuck with CUnit! How do I make a CUnit?! What must I write or move into it? Need it to have Collide with it? Or just a bool to tell if alive?! Plz help me with this! Thanks!

Share this post


Link to post
Share on other sites
Well, your question is not an easy one to answer, but I am making an RTS game too and I''ll tell you what I have been doing.

First of all, I''m not entirely sure what you mean by "Unit" so I''ll just explain my entire organization.

Simply put, I have one base class, CObject. CObject stores health and visibility and any other variable that every single object in the entire game has.

Then I have 3 child classes from that (This is called inheritance. Every thing from the parent class gets passed on to the child class). These three classes are Foot-Soldiers, Tanks, and Buildings. These all have many different functions of there own. Because of the concept of inheritance, they have life, visibility, and anything else that CObject had. Then I break it down further from foot-soldiers (using another child class...grandchildren u could call them). I break it down into Marines, Navy, Police Officers, etc. I use a linked list to link each police officer to each other, each navy officer to each other, etc.

I really need to learn more specifics about your design before I can answer your question properly. But I would definitely have anything that moves have a collision detection. Buildings could possibly only have a bool for determinining if their alive, but you probably will want them to be able to do other things....for instance, be repaired.

If you have any other questions, feel free to email me at NYYanks432@hotmail.com

Share this post


Link to post
Share on other sites
quote:
Original post by Pipo DeClown
I really suck at making an RTS-engine...
No, I dont actually, but Im stuck with CUnt!
How do I make a CUnt?! What must I write or move into it?
Need it to have Collide with it? Or just a bool to tell if alive?!
Plz help me with this! Thanks!



hmm

Share this post


Link to post
Share on other sites