Skip to content

Please update your browser

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

Transcript

With just one object falling, the game is pretty easy.

This video is showing how to make copies or clones of the falling object.

Click on the blue star.

In the control menu, find the block that creates clones called 'Create clone of myself'.

Drag this block into the scripts area.

Separate from the code that makes the object fall.

Click on it.

It looks like nothing happens, but when you move the object you'll notice there is a copy under it.

Next, make the copy fall as soon as it is created.

From the control menu place the 'When I start as a clone' block at the top of the code stack that makes the object fall.

To test this click 'Create clone of myself' block.

A copy of the object should appear at a random location at the top of the screen then fall.

It does.

To make more than one falling clone add a new forever loop around the 'Create clone of myself' block.

Test the code by clicking on the forever loop.

Wow, that's way too many clones.

The game will be too hard with this many objects falling.

Plus your computer might crash trying to keep track of all of them.

Slow down the creation of clones by adding a 'Wait' block inside the loop that creates the clones.

Make the game more unpredictable by adding a 'Pick random' block inside the 'Wait' block.

Make the wait time between clone creation as short or as long as you'd like for the game you'll play with your friend.

Tinker until the game works the way you like it.

Clones should start appearing at the beginning of the game.

Place a 'When' flag clicked block above the clone creating forever loop.

There's still a lot of clones for your computer to keep a track of.

And the game only needs the keep the clone until it hits the ground.

From the control menu drag out the 'Delete this clone' block.

'Delete this clone' makes the clone go away.

The clone should disappear if it touches the bottom of the stage.

It can tell if it has touched the bottom of the stage if it touches the green grass color.

From the control menu choose an 'If' block and place it around the 'Delete this clone' block.

From the sensing menu place a 'Touching color condition' inside the 'If' block.

To make sure the right color is selected click on the color in the box then click on the green grass on the bottom of the screen.

The box should change to green.

Put this if block inside the forever loop that makes the objects fall.

Now that code reads 'When I start as a clone, go to a random spot at the top of the screen then fall.

if I touch the green grass color delete myself.

Test the code by clicking on the green flag.

Objects should fall from the sky and disappear when they hit the ground.

Great.

Finally, hide the first object.

It's not a clone, so it's not programed to fall.

It just hangs out at the top of the screen.

To hide it when they game starts place a 'Hide block' under the 'When flag clicked' block.

This would also hide the clone so place a 'Show' block under the 'When I start as a clone'.

Test by clicking the green flag.

Awesome.

The first object hides, but the clones show and fall.

Now it's your turn.

Create clones using the 'Create clone of myself' and 'Wait' blocks inside a forever loop.

Make the clone fall by adding a 'When I start as a clone' block.

Delete the clones when they touch the green ground.

Add a 'When flag clicked' block to the top of the block stack.

Hide the original object and show the clones.

Instructions
  1. Create clones using the "create clone of myself" and "wait" blocks inside a forever loop.
  2. Make the clones fall by adding a "when I start as a clone" block.
  3. Delete the clones when they touch the green ground.
  4. Add a "when flag clicked" block to the top of the block stack.
  5. Hide the original object, and show the clones.