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 184a

Generators - simple

In this lesson you will create cloning effects (copies of sprites). Such effects are often called generators.

 

NOTE: You need to use Scratch Desktop (version 3 of Scratch) or higher.

 

Complete these steps ..

 

1. Open Scratch, OR use File > New to create a new game ..

 

 

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

 

You will have these sprites ..

 

 

3. Select the Stage.

Add this code ..

 

 

4. Select the Generator 1.

Add it's code.

Notice how clones are created forever. Also notice how after each clone is created and animated, it is deleted ..

Press the B key on your keyboard to test your code.

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

 

 

5. Select the Generator 2.

Add it's code to create a different effect.

The code is very similar to Generator 1 but this sprite has a simple line for a costume costume instead of a dot ..

Press the B key on your keyboard to test your code.

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

 

 

6. Select the Generator 3 sprite.

Add it's code to create a bubble effect.

This code is more complex and uses the ghost effect to make the clones slowly appear ..

Press the B key on your keyboard to test your code.

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

 

 

7. The next generator is rain, so we need a cloud from which it will fall.

Select the Cloud sprite.

Add its code ..

 

 

8. Select the Rain sprite.

Add it's code.

Notice how the sprite is cloned, then each clone is moved to a random x-position before falling (moving down) ..

Press the B key on your keyboard to test your code.

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

 

 

9. Use File > Save to your computer to save your game. Name it Generators simple v1.sb3

 

 

10. Well done, you've completed this exercise. Can you create a new sprite and code your own generator?