Making danger real with player death
In Chapter 10, Upgrading the AI Enemies, we made significant progress toward a balanced game in which enemies threaten the player but the player can use skill to overcome that challenge. One element remains glaringly missing. If the player runs out of health, then they should not be able to continue progressing through the game. So, we will take what we've learned about from the win screen we created in Chapter 8, Creating Constraints and Gameplay Objectives, and apply it to a lose screen. This screen will enable the player to restart the level with full ammo and a freshly filled health bar, but will also negate any progress they had made toward reaching their target goal.
Setting up a lose screen
The lose screen will be presented when the player runs out of health. We will present them with options to restart the last round or quit the game. You may remember the win screen we created; we presented similar options there. Rather than remaking...