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. One Falling Object

Transcript

This video will show you how to make an object fall from the sky so that the characters can catch it.

First, make the object fall.

Click on the blue star.

From the motion menu, use the “change y by” block.

When you click on this block, notice that the blue star goes up on the screen.

To make the object fall, change the value in the “change y by” block to a negative number.

Test it out.

The object goes down each time you click the block.

Tinker with the value to determine how fast or slow the object falls.

To make the object keep moving down, drag out a forever loop from the control menu, and put it around the “change y by” block.

Next, code the blue star to return to the top of the screen.

From the motion menu, drag out a “go to x y” block to set the object’s starting position.

Type in “170” in the “y” portion of the block.

170 is near the top of the screen. Click on it to test.

The object should move to the top of the screen.

Snap the “go to x y” block above the “forever” loop.”

Click on the code. The sprite starts at the top of the screen and falls all the way down.

To make this game more fun, the object needs to fall from different spots so that the characters must move to catch them. To make the object fall from an unpredictable spot, go to the “operators” menu, and place a “pick random” block in the x value of the “go to x y” block. The left and right edges of the screen range from -240 to 240, so enter those values into the “pick random” block. Click on the code to test it. The object starts at the top of the screen and falls down. Click the stop sign, then click on the code again.

The object starts in a different spot and falls. Great!

Now it’s your turn: Program the object to fall by putting a negative number in the “change y by” block and using a “forever” block.

Program the object to start at the top of the screen using the “goto x y” block Program the object to start at a random location using a “pick random” block.

arrow_backward Back
Next arrow_forward
Instructions
  1. Program the object to fall by putting a negative number in the "change y by" block and using a "forever" block.
  2. Program the object to start at the top of the screen using the "go to x y" block.
  3. Program the object to start at a random location using a "pick random" block.