Object modelling.
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.
std::vector is good if you don''t need to insert/remove items from the middle of the list much.
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.
This posting was brought to you by the letters N, I, T, P, C and K.
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
[size="1"][[size="1"]TriangularPixels.com[size="1"]] [[size="1"]Rescue Squad[size="1"]] [[size="1"]Snowman Village[size="1"]] [[size="1"]Growth Spurt[size="1"]]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement