It seems that the development phase has swept by in the past few weeks and we already have a working engine in DirectX9.0. We have implemented a Game state manager, have declared multiple classes and created a few game objects including a grid of the level and an animated character. The engine is almost done, all we have to incorporate is physics, the weapon, and a monster. So far the biggest issue I had was implementing a HUD that stores objects in it.
At first I had decided to use a small array of void pointers; however, this lead to type casting issues. I decided against this. It seemed that the easiest description of an inventory is a list of class objects. Now, how do I implement different objects into a list? At first I thought I could initialize it with a template parameter of the GameObject class and add children to that. Nope, this caused an issue that is caused slicing. Essentially, it cuts down the child class to its parent class and loses the other data. To fix this, I simply had to assign the template as a pointer to the parent class, and whenever I add a new object, I use the new declaration and that fixes the slicing issue.
I will keep up to date on our week 6 progress.
No comments:
Post a Comment