User Guide
Table Of Contents
85
You can snap any number of blocks into the middle of the if and
if…else blocks. This includes adding other if blocks to create
highly-complicated decision-making.
Controlling Your Scripts with a Keyboard and Mouse
Users play Scratch games and interact with projects using the
mouse and keyboard.
There are two blocks in the Controls section of the Blocks Palette
that you can use to start a script when a key is pressed, or when
the user clicks with the left mouse button. These blocks have
curved tops and so you cannot place them in an existing script,
they must always start a new script.
In games, the when key pressed block is used many times to
move a sprite when the player presses one of the arrow keys.
Figure 6. Multiple scripts to control a sprite
All sprites can listen and react to the same key presses.
Block Description
if ? Runs the blocks inside it, if the attached Boolean
operator is true.
if ? else Runs the blocks in the top section if the attached
Boolean operator is true, and the blocks in the
bottom section if the attached operator is false.
Block Description
when ? key pressed Runs the blocks snapped below when the user
presses a key on the keyboard.
when sprite clicked Runs the blocks snapped below when the user
clicks on a sprite.