GoalTurn the steps of an algorithm into Scratch blocks and say which group each block comes from.
New words
category · a group of blocks that do the same kind of job, such as Motioncostume · one of the pictures a sprite can wear, used to make it look as if it movessound · a noise that a sprite can play
Explanation
A good way to write a program is to write the algorithm first, as a list of steps. Then change each step into one block. The step that starts the program becomes a hat block from the Events group. Steps that move a sprite come from Motion, such as go to and glide. Steps that change how it looks, such as switch costume, come from Looks. A step that waits comes from Control, and a step that makes a noise from Sound. The last step, Stop, has no block: the script just ends.
Worked examples
Step
Instruction
1
Start when the space key is pressed
2
Go to x: −120, y: −40
3
Start the sound Bubbles
4
Glide 2 seconds to x: 120, y: 60
5
Wait 1 second
6
Change to the next costume
7
Stop
This algorithm for a fish becomes the six blocks in the picture: the hat block, go to, start sound, glide, wait and next costume. Step 7 (Stop) needs no block. So 7 steps become 6 blocks.
Block
Group
when [space] key pressed
Events
go to x: y:
Motion
next costume
Looks
switch costume to
Looks
wait (1) seconds
Control
start sound [Meow]
Sound
Each block belongs to a group, so we know where to look for it in Scratch.
Order matters. In this script the costume changes first, and then the sprite waits. If we swap the two blocks, the sprite waits one second before it changes its costume, and everything looks different.
Class activity
Block cards (with a friend): write each step of an algorithm for a sprite on a strip of paper, such as “Go to x: 0, y: 0”, “Wait 2 seconds”, “Glide 1 second to x: 100, y: 0”. For each step, say which group the block would be in. Then lay the strips in order. This is your program. If you have a computer or tablet, build it in Scratch and run it.
Practice
1
Which group does each block come from? go to x: y:, wait (1) seconds, switch costume to, start sound.
go to: Motion. wait: Control. switch costume to: Looks. start sound: Sound.
2
Write the blocks for this algorithm: 1 Start when the a key is pressed. 2 Go to x: 50, y: 0. 3 Glide 1 second to x: −50, y: 0. 4 Stop.
when [a] key pressed, go to x: (50) y: (0), glide (1) secs to x: (−50) y: (0). Three blocks.
3
How many blocks does the fish script in the explanation have, and where does the fish end?