How can I store spell & items using a std::vector implementation?
Posted
by
Vladimir Marenus
on Game Development
See other posts from Game Development
or by Vladimir Marenus
Published on 2012-11-05T16:14:29Z
Indexed on
2012/11/05
17:20 UTC
Read the original article
Hit count: 503
c++
|text-based
I'm following along with a book from GameInstitute right now, and it's asking me to:
Allow the player to buy and carry healing potions and potions of fireball. You can add an Item array (after you define the item class) to the Player class for storing them, or use a std::vector to store them.
I think I would like to use the std::vector
implementation, because that seems to confuse me less than making an item class, but I am unsure how to do so. I've heard from many people that vectors are great ways to store dynamic values (such as items, weapons, etc), but I've not seen it used.
© Game Development or respective owner