Scratch exercise 30

Throw a fireball at a fox

In this exercise you will create code at allow a cat to throw a fireball at an attacking fox with automatic aiming.

 

NOTE: You can use any version of Scratch.

 

Complete these steps ..

 

1. Open Scratch, OR create a new game (from the top menu choose "File>New").

 

 

2. Select the cat sprite under the stage and re-name it "Cat".

Now add this code to the cat to set its starting position and to make it move with the left and right arrow keys ..

 

 

3. Click the "only face left right" button ..

If you are using Scratch desktop add this code ..

 

Press "B" on your keyboard and then the arrow keys to test your game.

Press the "E" key to end it when you are ready to continue working on your game.

 

 

4. Choose a new sprite animal ..

 

Name the sprite. We have used a Fox.

 

Now add this code so the Fox moves around the stage ..

NOTE!! You will have to complete the "touching fireball" script after you have painted your fireball.

 

Press "B" on your keyboard and then the arrow keys to test your game.

Press the "E" key to end it when you are ready to continue working on your game.

 

 

5. Use the File menu to save your game. Name it "Fireball throwing v1" ..

 

 

6. Use the "Paint new sprite" button under the stage to paint a right facing fireball ..

 

.. and then set the costume centre to it's tail, like this ..

NOTE: Make sure the fireball is facing right.

 

Re-name the sprite "Fireball" ..

 

 

7. It is important that your fireball is not too big. It should be smaller than the Cat. Add code like this to it ..

You need the Fireball to be smaller than the Cat sprite so "set size to" may need to be smaller than 40%.

 

 

8. Now complete the code for the fireball so the cat can throw it ..

 

Note that the fireball is automatically aimed at the fox.

 

Press "B" on your keyboard and then the arrow keys to test your game.

Press the "E" key to end it when you are ready to continue working on your game.

 

 

9. Use the File menu to save your game.

 

 

10. Well done, you've finished this exercise. Can you turn it into a game by adding sprites, backgrounds and perhaps scoring?