Victory and defeat
Equipped with the Eagle aircraft, you can accept the challenge to maneuver through a mission. Depending on your skill, you may reach the end of the level and become a pilot legend. Or you fall victim to the enemy fleet and die in a horrible plane crash.
Anyway, the player should be informed by the game about his fate. In most games, there are victory and defeat conditions. In our airplane game, a mission is complete if you cross the level's border at the end. A mission is failed if your plane is destroyed. To display this information, we have written GameOverState
that displays an appropriate message. Of course, this can be extended to show high scores, statistics, or save the game between multiple missions. But the basic principle remains the same. We reuse the states and GUI from the previous chapters. Since their implementation should be clear, we do not paste their code here. However, you are free to look at the original code base at any time.