Building a horde of zombies
Now we are armed with the TextureHolder
class to make sure that our zombie textures are easily available, as well as only loaded into the GPU once, we can look into creating a whole horde of them.
We will store zombies in an array and as the process of building and spawning a horde of zombies involves quite a few lines of code, it is a good candidate for abstracting to a separate function. Soon we will code the CreateHorde
function but first, of course, we need a Zombie
class.
Coding the Zombie.h file
The first step to building a class to represent a zombie is to code the member variables and function prototypes in a header file.
Right-click Header Files in the Solution Explorer and select Add | New Item.... In the Add ...
Get Beginning C++ Game Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.