Advertisement

Object modelling.

Started by February 08, 2003 12:43 PM
4 comments, last by Themonkster 21 years, 9 months ago
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.
Linked lists are good.

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

Advertisement
When using Java, std::vector won''t get you far. Vector would be better ;-)

This posting was brought to you by the letters N, I, T, P, C and K.
LOL (for real). I should pay more attention, shouldn''t I?
well vectors it is then.


cheers for the help.
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

This topic is closed to new replies.

Advertisement