9
Completing the Adventure Game
In Chapter 8, we started by creating a flexible health system that can be added to any object to give it health, take damage, and heal. The system is extensible, meaning the things that can deal with damage and apply healing can be anything without the need to modify the HealthSystem class because we used interfaces to implement the behavior (not concrete class types). With objects now able to take damage, we continued by updating Player and enemy objects to use health – so, we have the semblance of a real game in the making.
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 us to add more complex enemy behavior, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access