OOP and the Zombie Arena project
The initial problem we are facing is the complexity of the current project. Let’s consider that there is just a single zombie; here is what we need to make it function in the game:
- Its horizontal and vertical position
- Its size
- The direction it is facing
- A different texture for each zombie type
- A sprite
- A different speed for each zombie type
- A different health for each zombie type
- Keeping track of the type of each zombie
- Collision detection data
- Its intelligence (to chase the player), which is slightly different for each type of zombie
- An indication of whether the zombie is alive or dead
This perhaps suggests a dozen variables for just one zombie, and entire arrays of each of these variables will be required for managing a zombie horde. But what about all the bullets from the machine gun, the pick-ups, and the different level-ups? The code from the much simpler Timber...