Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

3. Clonare lo sprite volante


In this video, you'll learn how to create many 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 or function. Without instructions, clicking the "create clone of myself" block will make a clone of the sprite appear on the stage, but the clone will not 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 the "when I start as clone" block, then 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.

Whoa! 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. Great! You now have several clones zipping across your 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.

arrow_backward Indietro
Avanti arrow_forward
  1. Crea un clone dello sprite.
  2. Fai volare il clone da una parte all'altra del palco.
  3. Fai volare tanti cloni da una parte all'altra del palco.
  4. Rallenta il processo di creazione dei cloni.
  5. Fai scomparire i cloni una volta terminato il loro volo da una parte all'altra del palco.