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. Creating Clones

Transcript

Today's starter project has a gray architect's toolbox at the top.

In this box are building piece sprites that the user of your software can use to create a building.

To allow someone to select a building piece sprite from the toolbox, you'll need to program them so that one: when a sprite is clicked it creates a copy or clone of itself.

Two: the clone follows the mouse pointer until the mouse is clicked again.

And three: the clone stamps on the stage.

The next few videos will walk you through how to program the arch sprite.

You will program the rest of the sprites on your own.

First, create a clone, this clone will become what you stamp, so the building piece sprite can stay in your toolbox.

A clone is a copy of the sprite.

The clone looks just like the original sprite and does whatever the sprite does.

From the control menu, drag out the create clone of block.

Click on the create clone of block to test what it does.

It looks like nothing happens.

If you click and drag the sprite away from the toolbox however, then you'll see that there's a copy underneath it.

For today's project, clones should appear when the user clicks on the original sprite.

Go to the events menu, drag out the 'when this sprite is clicked' block, and place it above the 'create clone of myself' block.

To test, click the sprite to make a clone, then click and drag the sprite to move it aside.

You should see the clone beneath the original sprite.

Click on the stop sign to remove all the clones.

Then, drag the building block sprite into its spot in the toolbox.

Now it's your turn.

Make a clone of the sprite in the toolbox with the 'create clone of' and 'when this sprite is clicked' blocks.

arrow_backward Back
Next arrow_forward
Instructions
  1. Create a copy of the building block sprite.
  2. Make the clone appear when the building block sprite in the toolbox is clicked.