Pride and fall, weaponManager, equipManager and itemManager
|
Some complaints and emotional update here serious part bellow You might not have taken it from the way I write but I have a hard time asking for help when it comes to code. Why that really is I don’t know but I have that and so for today I asked for help from a million people because of this page:
I have seen that page around 50 times today and I hate it OH GOD do I hate it. Now that is out of the way I got a suggestion to be more… professional when I talk about code I do and I have taken that comment to my heart and buried it deep. So deep. Well enough joking lets talk CODE! This is the serious CODE part ——- The part I have worked on this week is WeaponManager, EquipManager and ItemManager. Since the Item manager will get and use items just like weaponManager will use weapons I have not made any attempt to make a itemManager until the weaponManager Works to my advantage. -std::map So I learned a little more about how std::map works today since I learned today why the WeaponManager might have malfunction. I tried to get data in the wrong way and that made all the difference. First of all after making a std::map, a good idea is to use it. After about half the day looking for a reason why I ended up on the page above me all the time or always got ”BREAK” error messages I realized I did not take any data from the std::map. So I had to ask for a help there because I tried to read it in other ways. A little instructions. to make a std::map using a struct is a really good move. Like this struct weaponSkeleton{ std::string identifier; int magazine_size; float bullet_speed; Yes it will keep the data for you and you can sit back and relax. Well maybe it isn’t that easy. To read in the data you have to use the identifier from what I gathered the storage go like this: identifier -> all other information , identifier -> all other information. So to get the right information you need the identifier first and so this is an example in how you load it. auto it = m_weaponData.find(name); so as you see this is the correct way of doing it. This is how I did it: created a pointer to the struct* m_stupid_move m_stupid_move->magazine_size; and that did not work. First of all I already had a pointer so making a new one was not the best idea I ever had and also look at the code above this. Yes I already had that code. So now you know how std::map works. –equipManager Now here is something I am a little more proud of…*ahem* So short version of how it will work in the future. The equipManager will be executed when a player and specific entity’s collide such as items and weapons. It will then take a look can I store this for the player? Yes I can or no an item is there let’s get rid of it and replace it with this new item. Now to make this work I took help from what I learned in creating the weaponManager and made a couple of setName. but to make it easier for me using two setName1 and setName2 seemed to make it better because I would have two slots and I will get pictures for two things because the GUI will change when the equip is done. Now for that part it seems to work I did not test it because the weaponManager called for debugging, but the shell is up. Here is something I got as a suggestion though. std::cout << ”Slot 1″ << std::endl; to see if the code work. Now I will test this after the weaponManager is done but yes this is how it should work. –WeaponManager I have nothing to say, the progress was slow here and other than mentioned about the std::map above I have made little to none progress. I thought I had made more progress than that but I still can’t make that bullet I want to fire, fire (so that you can see it in the program). –Last Ramble Thank you good reader for making it this far. Now I will tell you a joke to lighten your mood. ”Who goes in the night, with cane and pointy hat?” ”THAT EVIL PICTURE UP THERE HE IS AFTER YOU AND WANT’S YOUR SOUL!”
|
