Weekly blog assignment #2

Hello everyone!

This week I worked with removing bugs and all around polishing the code. Everything from adding a monster pool that holds all the new instances of monsters that we create in the beginning to fixing small bugs such as the items that the player can throw respawning in the wizards thought bubble but rotated wrongly.no-bugs

I first started out with fixing the small bug with the items respawning rotated the wrong way. This bug happened because of the way we reused the thrown items.
We had a pool of items that held all the items that we had implemented into the game. In the game the player is allowed to choose between three different items. The way the items that are presented to the player is by picking out three different random items from our pool of items (a vector filled with all the items) and then when one item was thrown a new one was picked out, once again at random, and the item that was recently thrown gets put back into the list. Here is what we earlier forgot to do, when the item was put back into the list, we never restored its values to what it was supposed to be in the start. So when an already thrown item was spawned again for the player, that item started out with the same values as when it was removed from the players sight. Because when the player throws the item, we rotate it for simple visuall feedback, the item spawned again with the same rotation as when the item was deactivated. To fix this small problem all I did was adding a simple reset function that restored the values of the item to what it was supposed to be when it spawned for the player inside the thought bubble.

The big thing I did this week that took me several hours and was really tough was creating the monster pool.
The monster pool was, just as the item pool, a vector filled with all the monsters that we have, of course with differences here and there. As a temporary number, I added twenty monsters to the pool, five of each kind (as we have 4 different kind of monsters). This part was not very hard but I somehow small errors slipped through my sight and I had to spend some time to find the fault. The real challenge for me was when I wanted to spawn the monsters. I have little experience with vectors and I am not quite sure how to handle them and what actually happens when we chose one of the objects inside the vector. First I thought that, when we chose one of the objects, the item is actually pulled out, but I have now learned that that is not the truth.
By writing for example: m_vector[i].Activate(); what actually happens is that I activate the Activate function of that object inside the vector at the [i] position. But the object is still inside the vector. When I finally understood this the rest was quite easy, all I had to do now was refine the Activate function that first activated the monster, then restored its position, health, speed, texture and more to what it was supposed to be at the time of spawning.

More than these two tasks, all I have done is polishing the game for the alpha showcase tomorrow.

Hope you enjoyed reading and have a swell week and I hope you come back next week!

Regards,

Ara

About Ara Mohammad

2014  Programming