Summary
In this chapter, we covered the implementation of a health system that any object in the game can use to receive damage, heal, and handle the final death/destruction of the object. This system was designed using interfaces to tie everything together in an extensible way without relying on concrete class references – the flexibility of interfaces allowed for the quick addition of new functionality to our existing code.
We continued by creating a wave spawner that instantiates new enemies on a fixed time interval and integrates with the existing patrol behavior. This allows for adding in more complex enemy behavior, which adds new challenges to the game. Additionally, we discussed how to disable physics interactions between objects, which allowed patrolling enemies to pass each other in this case.
Finally, we further explored composition by refactoring some of our reusable components to explore a different approach to destroying the heal pickup object. Through examples...