Student Subscription site screenshot Subscribe now

Subscribe to our Student Site to access all of our Games Coding Lessons for just £8 per month


Scratch games coding lesson 30

Throw a fireball

In this lesson you will create code to allow a cat to throw a fireball at an enemy.

 

NOTE: You must use Scratch 3 or higher.

 

Complete these steps ..

 

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

 

 

2. Download, save and then load this game file ..

Cat throws a fireball v1.sb3

 

 

3. Select the Cat sprite under the stage.

Now add this code to set its properties before the game begins ..

 

Now add the code so the player can move the Cat with the arrow keys on their keyboard ..

Press B on your keyboard to test your game. The Cat should walk around the stage.

When you are ready press E key to end your game and continue working on it.

 

 

4. Select the Bear walking.

Now add this code to set its properties before the game begins ..

 

 

Now add this code to make the Bear walking sprite chase the Cat sprite ..

Press B on your keyboard to test your game. The Cat should walk around the stage.

When you are ready press E key to end your game and continue working on it.

 

 

5. Select the Fireball sprite.

Now add this code to set its properties before the game begins ..

 

Now add the code to the Fireball so the Cat sprite can throw it when the mouse is clicked (mouse-down) ..

Press B on your keyboard to test your game. The Cat should walk around the stage.

When you are ready press E key to end your game and continue working on it.

 

 

6. Use File>Save to your computer to save your game. Call it Cat throws fireball v1.sb3 ..

 

 

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