Scratch exercise 06

Repeat loops - simple

Repeat loops are a great way to create animations. This exercise will get you started using them.

Anything you put inside a repeat loop will repeat and then stop. For example, in the following script a sprite will move 100 steps (pixels) right ..

 

If you change the number of repeats the distance will change. Here the sprite will move 50 steps (pixels) ..

 

 

Complete these steps ..

 

1. Create a new game. Either open Scratch or if it is already open choose "File>New" ..

 

 

2. Re-name sprite1 "Cat" ..

 

 

3. Click the "only face left right" button to make sure Cat can't turn upside down ..

 

 

4. Add the script to set the Cat size and start position ..

You can experiment with the start position later, placing your Cat somewhere else on the stage.

 

 

5. Press the "B" key on your keyboard and the Cat should shrink and jump to the left side of the stage.

 

 

6. Add the first script for your animation. You will add your repeat loop scripts to this ..

 

Now add some repeat loops which you can use for your animation. Add these simple walking ones first ...

 

 

7. Stack the scripts you have just made to make a simple animation in which the Cat walks in a square ..

 

Press "B" to test your animation.

 

 

8. Use File>Save as to save your game, name it "repeat loops simple" ..

 

 

9. Here are some more repeat loops that you can add to your animation ..

 

Jump ..

 

Grow and shrink ..

 

Walk in a circle ..

 

You can make your own repeat loops too.

 

 

10. Now, make your own animation! Can you make some new repeat loops of your own?