So this weekend, we are having to add some stuff to our scripts we previously did to make them better. I’m pretty partial to the one I made for the last class called Geoffrey the Giraffe’s Magical Adventure, so I decided to stick with it. I’m still pretty rudimentary with the C++ knowledge I have so far, so I’m using a lot of if statements and switches and such. However, the professor asked over the weekend that we add some functions to it and maybe add some stuff to the AI to make it work better. Lucky for me I didn’t have any AI or the latter, so I get to do both. They sound pretty simple but for me for some reason I have to make things difficult on myself and spend hours trying to find out the simplest things, like brackets missing or whatever. But at the current moment I’m confused because I have some code that I borrowed from our textbook used in the main() function, but I’m trying to take it out of its function to use in the rest of mine.
vector<string> inventory; //creates the inventory
inventory.push_back(“2. clothes hanger”);
inventory.push_back(“3. spit wad”);
inventory.push_back(“4. your uncle Jeff”);
Sounds simple, right? Well not for little old me it isn’t! I tried to pull it out of Main() and create a separate function altogether called “InventoryBag()”, but then I didn’t know how to call specific parts of the function, like the ‘inventory.size’ which is constantly being called on throughout the Main() script as well as the others. At the current moment I’ve resolved to just relisting it inside of every single function, but I know that isn’t a good idea. However at the moment it’s going to have to do. I spent way too long just trying to realize my curly brackets were the reason my void function wasn’t working. (Award for the day goes to me! )
But if you’re just DYING to know what my game is like, I’ll post the script later at some point to let you see it. That is ASSUMING that you like giraffes…