Raspberry_Pi_Education_Manual

Notes:

It looks a bit different because it has a gap so that we can put code you want to repeat inside it. Just drag the “repeat [10]” block to sit directly under the “when Sprite1 clicked” block. It will automatically fit around your block of code, causing it to repeat itself.

Here is the code we need to animate the bee so that it flies all the way from one side of the screen to the other.

Using the repeat loop, you can make the sprite do the same actions over and over again. So the bee flaps its wings up and down many times.

Over to you

Question: Why do you think I have increased the number of times it repeats from 10 to 20? Task: Some of the Scratch sprites already have two costumes. Check out the Scratch cat sprite. Use its two costumes and code similar to the example on the left to make it walk.

Tip...

If your bee flies in the wrong direction, check the sprite to make sure that it is facing in the correct direction. With the sprite selected, look at the bar above the Scripts tab. The “forward” direction of a sprite is indicated by a little blue line. The bee on the left will move 90° to the vertical and the bee on the right will move 60° to the vertical. You can rotate the line to change the move direction of a sprite.

A beginner’s guide to Scratch

20

Made with FlippingBook flipbook maker