Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/265528219271319553
deleted 133 characters in body; edited title
Source Link
user1430
user1430

How To Store Spells And Items Using Acan I store spell & items using a std::vector Implementationimplementation?

Good morning!

I'm very new to gamedev, and only slightly less new to C++. 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."

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::vectorstd::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.

My apologies for the general-ish question, but I hope you can help!

How To Store Spells And Items Using A std::vector Implementation

Good morning!

I'm very new to gamedev, and only slightly less new to C++. 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.

My apologies for the general-ish question, but I hope you can help!

How can I store spell & items using a std::vector implementation?

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.

Source Link

How To Store Spells And Items Using A std::vector Implementation

Good morning!

I'm very new to gamedev, and only slightly less new to C++. 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.

My apologies for the general-ish question, but I hope you can help!