Our online Scratch coding courses are an ideal way to experience our lessons at home. Try a free lesson.
£24.99 or less
Begin and end a game with keyboard key presses.
NOTE: You can use any version of Scratch.
Complete these steps ..
1. Open Scratch, OR create a new game (from the top menu choose "File>New").
2. It is always best to name your sprites.
Select the cat sprite, then click in the name box to change the cat sprite's name from "sprite1" to "Cat" ..
.. or if you are using Scratch Desktop click and type in the Sprite naming box ..
3. Although it is easy to click the green flag above the stage to begin a game, and the red circle to end it, it is quicker to use keys on your keyboard ..
Find the "B" and the "E" keys on your keyboard. You will use the "B" to begin your game, and the "E" key to end it.
We won't use the "S" key because it could stand for "Start" or "Stop".
4. Let's make the cat turn around when we click the "B" key, and end the game when we click the "E" key.
Click on the cat sprites "scripts' tab and add these scripts/code to it ..
Press the "B" key to begin your game. Notice how the green flag turns bright green, or is highlighted.
When you are ready, press the "E" key to end your game. Notice how the green flag turns dull.
5. Now it is time to Use the File menu to save your game. You will name the game file "exercise 01a".
If you are using Scratch 1.4 .. Click here to learn how to save your game file.
If you are using Scratch Desktop .. Click here to learn how to save your game file.
6. Well done, you've finished this tutorial!