Scaling Models

The enemy HP values have been removed from above the enemies on the game screen, and a damage value that floats over the enemy when hit has been added.  I created a new class for overlay text, which is used by both the 2D and 3D game screen.  This prevents the code from being duplicated for things like the status text and enemy damage.  I added a new property to the enemy that is the dying state and counter.  This was needed because the damage value does not display if the enemy is not alive.  This kept the last damage number from displaying.  Now I’ve changed it so that the damage value displays if the enemy is alive or dying, so the final damage number now correctly displays.  The dying counter will also be needed to display a death/blowup animation.  On the 2D game display, I added logic so that the enemy just fades away using an alpha color value based on the percentage of the dying animation passed.


I created a simple graphic for the projectile.  I mapped this graphic to a simple 2D plane in Blender.  It’s important to remember that all points of the Blender model must have a Z coordinate equal or less than 0 (non-positive) to appear.  This may be backwards for my game, since I am rendering the 3D world with the Y axis facing downward, which makes translating from the 2D to 3D coordinates simpler.  Remember, the model coordinates are relative to the small orange dot, which is not necessarily the location where the axes cross in Blender.  It is a good idea to put the orange dot at coordinate 0,0,0 in Blender to keep from getting confused.  Therefore, all vertices must be moved in edit mode (not object mode) for the changes to appear in the game.  Similarly, scaling an object in Blender’s object mode will have not effect on the model in the game.  The model must be scaled in edit mode with all vertices selected for the size change to appear in the game.

Also, I converted the List of loaded Model objects to a Dictionary object.  I thought that a Dictionary was the same as a hash table, but Chris Gardner (@freestylecoder) explained to me that Dictionaries don’t allow multiple values to be assigned to a key like a hash table.  He said that Dictionaries should be used like symbolic links, which is what I am doing with my constants which represent each model in the game.  The previous method I was using was kludgy and bad style, which was adding the Model to the List and setting the constant ID of that object to the order number which it was added to the list.  That process was a hassle to maintain and a recipe for disaster later.