Think about it. If we want our game to pause, then we have to set some kind of flag that tells the game that we want it to take a break. We could set up a Boolean:
We would set
true if the game is paused, and set it to
false if the game is running.
The problem with this approach is that there are a lot of special cases that we may run into in a real game. At any time the game might be:
These are just some example of game states. A game state is a particular mode that requires special handling. As there can be so many states, we usually create a state manager to keep track of the state we are currently in.
Creating a state manager
The simplest version of a state manager begins ...