Create an ‘end’ screen to show the number of seconds that it has taken the player to find the bugs.
Sometimes, just beating a game isn’t enough. Players like to know how they did against other players or themselves. Can you think of a game that shows you how well you did?
Add the Chalkboard backdrop from the Indoors category.
Tip: In Scratch, you can add the same backdrop more than once.
Click on the Backdrops tab to open the Paint editor.
Change the name of the backdrop to end
:
Tip: You rename the backdrop to end to make it easier to understand your code.
Click on the bug sprite and add code to position the bug on the ‘end’ screen:
How long does it take you to find and click on the bugs? Scratch has a timer
that you can use to find out.
The timer
block is in the Sensing
blocks menu. Add code to make the bug say
the timer
on the ‘end’ screen:
Test: Click on the green flag to test your finding skills. How long does it take you to find the bug?
To go back to the ‘start’ screen, click on the bug on the ‘end’ screen.
Add code to make the bug stop saying the timer
when you go to the ‘start’ screen:
If you play the game a second time, the timer
will keep counting.
Add code to reset the timer
when the backdrop switches to
the first level:
Test: Click on the green flag and play the game. The timer should reset when you click on the bug on the ‘start’ screen to move to the first level. When you click on the bug on the ‘end’ screen, you should return to the ‘start’ screen and see that the bug is not saying the timer
.