Navigating between states
So far we have our state machine in place and running smoothly, the title screen starts up the program, but how to make the title screen call another state to its place when someone hits a key?
That is exactly what the
StateStack class's delayed push and pop mechanism is for. Inside a state
update(), you are given three methods to control the execution and transitions of states:
It is appropriate to use these methods to request new states to be pushed, or to show and replace the current one, as you will verify that our example states do throughout this chapter.
Creating the game state
So far we have covered the theory and practice for inserting ...