Scratch Silver III
Scratch Silver II
SCRATCH SILVER I
SCRATCH GOLD III
1 of 3

1.03 The shrink spell

Now you will get the Fairy to shrink when you click on the shrink button.

Click on the shrink sprite in the Sprite list below the Stage.

Add a when this sprite clicked block:

When you click on the shrink button, you want the Fairy sprite to shrink.

The shrink sprite needs to broadcastmessage so that the Fairy sprite knows that the shrink spell has been cast.

Add a broadcast block:

Click on message1 and choose ‘New message’. Name the new message shrink.

Your code should look like this:

Now when you click on the shrink button, Scratch will broadcast the shrink message, but nothing will happen yet.

Add code to the Fairy sprite to shrink when it recieves a shrink message:

Test: Click on the shrink button to shrink the Fairy sprite. Do this as many times as you like.

Debug: If your Fairy sprite grows instead of shrinks, add a minus - before the number 10 to make a negative number -10.

Add a script to set the Fairy sprite to normal size when the green flag is clicked:

When messages are broadcast they can be received by all sprites. When the Wand receives the shrink message it should play a sound.

Click on the Wand sprite and then the Sounds tab.

Add the Slide Whistle sound.

Rename the sound to shrink so it is easy to find.

Add a script to play the sound:

Test: Click on the green flag to run your project. Click on the shrink button to hear the sound and see the Fairy shrink.

The shrink button broadcast a shrink message. Both the Fairy and the Wand sprite received the message and responded.

×
×

Cart