Scratch exercise 143

Start and game over screens

In this exercise you will create a template game with start and game over screens which you can open and use whenever you make a new game.

 

Complete these steps ..

 

1. Open Scratch, OR create a new game (from the top menu choose "File>New").

 

 

2. Select the stage and add these scripts to show the start screen and PREPARE the game. Note that "prepare game" is used to show the start screen and get all the game sprites ready but the game will NOT start until "begin game" is broadcast ..

 

 

3. You need to create a start screen which will shows for 2 seconds before fading out, after which the game will begin.

To do this you need to paint your start screen as a sprite and NOT a background.

Click the "Paint new sprite" button under the stage ..

When the paint window opens click the "-" zoom button to zoom out so you can see all of the painting area. This will be the same size as the stage ..

Paint the background and then select the text tool. Set the text size to at least 36 point ..

Now create some text like this ..

You could add game instructions too if you wish.

You can move the text by clicking on the little black square ..

 

When you are done, click "OK" and then name the sprite "Start screen" ..

 

 

4. The start screen will show for 2 seconds when it receives the "prepare game" broadcast, after which it will fade out (using the ghost effect), wait a further 1 second, and then broadcast "begin game". This is the order ..

  1. "B" key is pressed and "prepare game" is broadcast
  2. Game sprites hide
  3. Start screen shows for 2 seconds
  4. Start screen fades out
  5. 1 second wait
  6. "Begin game" is broadcast
  7. Game sprites show and the game begins

Add this script to the Start screen sprite ..

 

Press the "B" key on your keyboard to test your game.

 

 

5. Use "File>Save as" to name and save your game. Name it "Template game" ..

 

A template game is a project with some scripts already completed that you can load to make new games. Make sure that everytime you use it, you use "File>Save as" to save it with a new name.

 

 

6. Although we are not making a full game, let's script the cat sprite so we have something happening between the start and end screens.

Select the cat sprite, re-name it "Cat" and then add these scripts ..

Press the "B" key on your keyboard to test your game. Move your mouse pointer on the stage.

Press the "E" key to end your game and continue working on it.

 

 

7. Create a Game over sprite using the same method you used to create the Start screen sprite, but this time add the text "press B to play again" ..

When you are done, click "OK" and then name the sprite "Game over screen" ..

 

 

8. Add these scripts to your game over screen sprite ..

 

The Game over screen appears when the "game over" broadcast is received. Let's create something to send this broadcast so we can test our game.

 

 

9. Use "File>Save" to re-save your game ..

 

 

10. Select the stage. We can create a simple countdown timer to send a "game over" broadcast.

Create this variable ..

 

Now add these scripts to the stage ..

 

Press "B" to test your game, it should last for 5 seconds!

 

 

11. Use "File>Save" to re-save your game ..

Well done, you've finished this tutorial.