Operation Manual

The Scratch language is naturally multi-threaded and partially object-oriented. This means that each object in the program, including sprites, can
have its own code attached, and that each section of code runs simultaneously and independently of any other block. Used properly, these features
allow for some quite complex programs to be created.
Figure 10-8: Adding the Cheesy-Puffs sprite to the Scratch game project
By default, any sprite added into a Scratch project will appear in the dead centre of the stage. As a result, this obscures the
existing cat sprite. Click on the new sprite and drag it to the right of the cat to fix the problem.
With the bowl of Cheesy-Puffs moved, its still too large for our anthropomorphic two-legged cat to eat. Click the Shrink Sprite
button, which is located at the top-right of the stage area and looks like four arrows pointing inwards. If youre not sure which
one it is, hover the mouse pointer over each icon for a short description of what it does.
Clicking the Shrink Sprite buttonor the Grow Sprite button, which does exactly the oppositechanges the mouse cursor into
a duplicate of the buttons icon. Using this new cursor, click on the Cheesy-Puffs sprite to shrink it. Keep clicking, and the sprite
will continue to shrink. Once its a sensible-looking size, click anywhere outside of the stage area to return the mouse cursor to
normal. You can then drag the bowl closer to the right edge of the stage, if you so choose.
Try using the arrow keys on the keyboard to move the cat sprite towards the Cheesy-Puffs sprite now. As you can see, when
the two sprites meet, nothing happens. Thats because the program doesnt contain any instructions for what to do when the two
sprites overlapknown as a sprite collisionso it doesnt do anything. This can be rectified with a new type of block: a Sensing
block.
With the Cheesy-Puffs sprite currently active (its image should appear at the top of the Scripts pane, but if it doesnt, just
double-click the sprite on the stage), switch the Blocks palette into Sensing mode by clicking the Sensing button. From the
Sensing palette, drag a touching ? block into the Scripts pane.
Like the when space key pressed block used to control the cat sprite’s motion, the touching ? block can be customised.
Click the down-arrow button next to the question mark, and choose Sprite1 (the cat sprite) from the list. This block will now be
activated when the two sprites collide.
You can name a sprite by clicking on the box next to its image in the Scripts pane and typing in a name. Giving the sprites sensible namessuch as
Cat, CheesyPuffs, and so forthmakes it significantly easier to track whats going on in the program.
Look at the shape of the touching Sprite1? block. As you can see, it has no jigsaw-like connectors on the top or the