Jump to content
  • Advertisement


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


Node or something else?

This topic is 5957 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 working on a new game building up the class system, although this problem is not related to that it''s a game so I posted here. It''s like a FF clone with only the fighting scene and I have classes like: Character (which is one of the fighters) Player (which is one of the two teams) in Player I declare the Characters as following: Character * itsCharacters; ... itsCharacters = new Character[numCharacters] and etc... I have functions which enables you to add and remove characters, very convenient but it has one flaw! I want to be able to input derived classes from Character, as for instance Monster(: public Character) Is there some way of doing this with the same simplicity I have now, because I know I can create like a node with the characters and which Player has the first characterNode. With Find functions and etc. Is creating a Node with Characters the best way?

Share this post

Link to post
Share on other sites
You can have
Character ** itsCharacters;

And then

itsCharacters = new Character*[numCharacters];

And when you're crating each one of them, you can have:

itsCharacters[ i ] = new Monster;

or anything else derived from Character for that matter.

[edited by - pouya on March 24, 2002 1:34:36 PM]

Share this post

Link to post
Share on other sites
Thanks for the tip!

Although in my prog-book they design a nice Node class which creates a chain and etc... Why is this even needed then?

*AARG* I can't delete that previous one =(


[edited by - Gee on March 25, 2002 10:00:22 AM]

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!