Chapter 4 Programming with Scratch^73
THE OFFICIAL RASPBERRY PI BEGINNER’S GUIDE
Start with a say Hello! block, then drag and drop a join Operators block over the word
‘Hello!’. Fill in the first box with ‘Your reaction time was ’, making sure to add a blank space at
the end, then drag another join block into the second box. Drag a timer reporting block from
the Sensing category into what is now the middle box, and type ‘ seconds.’ into the last box –
making sure to include a blank space at the start.
when clicked
say Hello! British ESA Astronaut Tim Peake here. Are you ready? for^2 secs
wait 1 secs
say Hit Space!
reset timer
wait until key space pressed?
say join Your reaction time was join timer seconds.
Finally, drag a set time to 0 Data variables block onto the end of your sequence, then
replace the ‘0’ with a timer reporting block. Your game is now ready to test by clicking on the
green flag above the stage. Get ready, and as soon as you see the message ‘Hit Space!’, press
the SPACE key as quickly as you can (Figure 4-13) – see if you can beat our high score!
5 Figure 4-13: Time to play the game!