Scratch exercise 98

Repeat loop animations advanced

In this exercise you willtry out the 2 types of Repeat Loop scripts.

They are ..

  1. repeat (number of times)
  2. repeat until (something happens)

 

Complete these steps ..

 

1. Create a new game (From the top menu choose File>New).

 

2. Select the stage, click the "scripts" tab and add these scripts ..

 

3. Select the cat sprite and re-name it "cat".

 

4. Add these scripts to the cat to get it ready for when you begin the game ..

 

5. Now let's use a repeat loop to make the cat move. You will use the "1" key on your keyboard to start a script which will make the cat rotate.

 

Add these scripts to the cat ..

Press "B" to begin your game and then "1" to try out your script. Press "E" to end your game.

 

6. Let's combine 2 repeat loops to make the cat jump. Add these scripts ..

Press "B" to begin your game and then "2" to try out your script. Press "E" to end your game.

 

7. Use "File>Save as" to save your game. Name it "Repeat loops".

 

8. Now let's use "repeat until" script blocks. This time the cat will gown and then shrink back again. Add these scripts ..

Press "B" to begin your game and then "3" to try out your script. Press "E" to end your game.

Note how with this script we have not said how many times the cat will grow or shrink. The script repeats until the correct size is reached.

 

9. Now, let's combine some of these ideas to create a complex animation. Add these scripts ..

Press "B" to begin your game and then "4" to try out your script. Press "E" to end your game.

 

10. Use "File>Save" to re-save your game.

 

11. You've finished, well done! Can you make your own repeat loop scripts?