Jump to content
  • Advertisement

Archived

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

Themonkster

Object modelling.

This topic is 5730 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

Hi, I am designing a game and this is my first OO game. I am using java for this. It''s a trading game. I have a player object which holds all the information for the player. however the player holds a item object which has it''s own attributes and the player can hold more than one of these item objects. How would I go about increasing the amount of items ? or am I looking at this wrong and should I build in the amount of item objects the player can have and then just make changes to the blank item objects when the player gains a item? I hope this makes sense.

Share this post


Link to post
Share on other sites
Advertisement
Linked lists are good.

std::vector is good if you don''t need to insert/remove items from the middle of the list much.

Share this post


Link to post
Share on other sites
quote:
Original post by Themonkster
well vectors it is then.


A minor note: use the more recent ArrayList instead of the Vector class, as it has more standard behaviour to correspond with the rest of the collection classes.

Even better, construct an ArrayList, but access it via the abstract List interface - if you ever want to switch it with a LinkedList or other list type, you only need to change a single line of code

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!