Raspberry Pi A User Manual page 185

Hide thumbs Also See for Raspberry Pi A:
Table of Contents

Advertisement

C H A P T E R 1 1
From the Looks block palette, drag a
if touching Sprite1?
add a
wait 1 secs
block to the top, changing the value to read
pressed
Finally, drag a
block from the Looks palette to the bottom of the loop to end up with
hide
the block list that's shown in Figure 11-9.
Double-click the cat sprite on the stage to return to editing its scripts. The script you created
for the Cheesy-Puffs sprite will disappear, but don't worry—it's still saved but only appears
when you're editing that particular sprite.
Drag another
block from the Control palette along with another
if
block, and this time, change the Sensing block so both blocks together read
. Into this block, insert a
Sprite2?
and a
2
say Hello! for 2 secs
. Finally, drag the whole stacked block up so it connects to the bottom of the
yum-yum!
existing
when right arrow key pressed
The final code for the cat sprite should look like the blocks in Figure 11-10.
A N I N T R O D U C T I O N T O S C R A T C H
say Hello! For 2 secs
conditional. Change the text to read
Control block, changing the value to
wait 1 secs
Looks block with the message changed to read
block into the centre of the
Don't eat me!
. Add a
2
when right arrow key pressed
touching ?
Control block with the value changed to
block, beneath the
move 10 steps
, and then
when space key
.
Figure 11-9:
Controlling the
Cheesy-Puffs
with a Scratch
if
sensing
if touching
Yum-
block.
169
block

Hide quick links:

Advertisement

Table of Contents
loading

Related Products for Raspberry Pi Raspberry Pi A

This manual is also suitable for:

Raspberry pi b

Table of Contents