Now that we have a basic gameplay experience, it's time to make the game end sometime, both in the cases of winning and losing. One common way to implement this is through separated components with the responsibility of overseeing a set of Objects to detect certain situations that need to happen, such as the Player life becoming 0 or all of the waves being cleared. We will implement this through the concept of Managers, components that will manage several Objects, monitoring them.
In this chapter, we will examine the following Manager concepts:
- Creating Object Managers
- Creating Game Modes
- Improving our code with events
With this knowledge, you will be able to not only create the victory and loose condition of the game, but also do that in a properly structured way using design patterns such as Singleton and Event Listeners. These skills are not only useful for creating the code for the winning and losing functions...