Chapter 17: Win and Lose Condition
Now that we have a basic gameplay experience, it's time to make the game end sometime, when the player wins or loses. 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 not only be able to create the victory and losing conditions of the game but also be able to do so in a properly structured way using design patterns such as Singleton and Event Listeners. These skills are not just useful for creating the winning and losing code of the game but for...