Choosing destinations – respawning to the most recently passed checkpoint
A checkpoint usually represents a certain distance throughout the game (or perhaps a race track) in which an agent (user or NPC) has succeeded in reaching. Reaching (or passing) checkpoints often results in bonus awards, such as extra time, points, ammo, and so on. Also, if a player has multiple lives, then a player will often only be respawned back as far as the most recently passed checkpoint, rather than right to the beginning of the level.
This recipe will demonstrate a simple approach to checkpoints, whereby once the player’s character has passed a checkpoint if they die, they are moved back to the most recently passed checkpoint:
Figure 11.11: The three kill spheres, separated by two checkpoints
In the preceding screenshot, we can see a player-controlled cube on the right. The game area contains three spheres that will kill the player when hit. The game area is divided into...