Step 5: Showing a Game Over Screen

Goal:


Awesome, that’s all the code that we’ll need for our game manager!

Let’s add one more small thing that can also help test our code, a Game Over screen.

After this code is done, test your code out. The game should have run for 30 seconds and show a Game Over screen once the time runs out.

Steps:

  1. Select the “Sprite1” sprite, all the following code will be for this sprite.
  2. From Events place a when green Flag clicked.
  3. From Looks place a hide block.
  4. From Events place a when I receive block.
  5. In that when I receive block, set the message to be “GameOver!”
  6. From Events place a go to layer block and change it to front.
  7. From Looks place a show block.

Code: