Creating a game over message

In its current state, our game is simply displaying a temporary scene when the player has no more lives left. Our next polishing task is to create a routine that will advise the player when the game is over and offer the appropriate options to the player.

The message will consist of a Game Over banner and two option buttons: one to allow the player to return to the game's main menu scene, and the other to allow the player to immediately restart the game. When completed, the Game Over banner will be presented to the player as shown in the following screenshot:

Creating a game over message

Let's jump right in and build the instructions to create the Game Over banner.

STOP!

Haven't we already created a very similar information banner? Our game over banner is almost identical to the success banner that we created in the previous section, Improving the level progression routine, so this is a great opportunity to save ourselves some work!

Reusing the existing banner event

We have two options available to us when we have an existing event that we want to reuse. The first option is to duplicate the event, give it a new name, and then work through the event methodically by updating any instruction blocks that need to be changed for the new, slightly different event. While this can be quite a quick process and can be a reasonable solution, it does have its pitfalls, the main one being that, if in the future we need to make any changes to the way the original event works, we will also have to make those changes in all other versions of the event. This not only leads to additional, repetitive work, but can also lead to the introduction of errors.

Although we only need one other banner for our game, we're going to take the second, smarter option, which is to modify the existing banner event so that it is completely reusable. In practice, we might have planned to create a multipurpose banner behavior right from the start, but the idea of using banners was not something that we had considered in the earlier stage of game development.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.197.212