High Score and Game Over

High Score and Game Over


Part E – Video

Video Transcript

There are just a few details left and our game we will be finished.

One of them is to create the maximum score and display it on the screen.

We will need the variable "HighScore". Let's introduce it into our program just as we introduced the variable "score".

I'll take it to the other corner...

Now open the bone scenario.

At the point where the score changes we have to compare it with "highscore".

If "score" is greater than "highscore" then "highscore" should be equal to "score".

Let's see this in practice.

Very nice! As a final touch to our game we will insert a large sign that displays the message "GAME OVER".

It is certain that this sign will appear at the end of the game.

That is, either when the ghost touches our dog or one of the cars does.

Initially, we should create this tag.

It will be a sprite. Click the "Paint New Sprite" button and draw your message. Let me do it too..

Let's not forget to set it in the center of the stage so that it does not show up at the beginning of the game.


Now that this sprite displays on the screen at the end of the game, you will need to be informed about it.

That is, both the cars and the ghost have to send out a message that the game is over so that the message is received by the "sign" in order to appear.

Let me first open the ghost script.

Where the game ends, I will enter the instruction to send a message.

From the 'Events' palette, select broadcast message'.

Once you have created the GAME OVER message, replace this instruction with the "Stop All" instruction.

The same code must be introduced to cars as well as they are the ones that cause the end of the game.

Now let's return to the GAME OVER. The sprites that cause the end of the game have sent the message.

We have to make sure that GAME OVER receives it and then it appears.

The instruction is simple. From the instructions palette select "When I receive GAME OVER".

Then it will show up and stop the game.

Let me try it....

The game is ready!


Think now about changes you could make in order for the game to be more interesting!

Enjoy the game!