In this video, you'll learn how to create mini sprites
that fly across the screen.
In Scratch, you can create a copy of an object
using the create clone block.
The clone will have the same attributes
and characteristics as the original object.
When you program the computer to create a clone
or copy of a sprite, you can provide instructions
or code for how the copy should look and function.
clicking the create clone of myself block
will make a clone of the sprite appear on the stage,
but the clone won't fly or do any other actions
the original sprite performs.
Use the when I start as clone event block
to provide instructions that will make
the new clone perform an action.
Add a when I start as clone block
and drag your go to and glide block stack under this event.
Now, whenever you click the create clone block,
the clone receives instructions
telling it to fly across the screen.
Clicking create clone multiple times
makes several clones fly across the screen.
To automate the cloning,
drag the create clone of myself block
into the forever block.
Wow, that's a lot of clones trying
to cross the screen at the same time.
Add a wait block to the forever loop
to slow down the clone creation.
Adjust the value in the wait block
until you like the clone creation pace.
You now have several clones zipping across the screen,
but they don't disappear
when they reach the right side of the screen.
To fix that, add a delete this clone block
after the glide block.
You might also want to drag your flying sprite
to one side of the screen.
Computer scientists like you often need
to test several solutions to a tough problem
before they find the one that works.
If your code isn't working correctly,
keep trying different fixes
until you solve the problem.
Now it's your turn.
Add the event, when I start as clone,
and place the code that makes your sprite fly under it.
Add create clone and wait blocks to the forever loop.
Add a delete this clone block to the bottom of the stack.
Sign in to track your progress and earn badges