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

In this add-on, you will add some weather to your commercial to demonstrate that the gadget works in even the most extreme conditions. Start by adding a new sprite. This will be the sprite that falls from the sky, whether it be rain, snow, or cats and dogs. You can either choose a sprite from the library, or draw your own. This example uses a small white circle to represent snow. Go to the scripts tab of the sprite you just created. To make the sprite fall, add a “point in direction” block, and select “down” from the dropdown menu. Then, add a “move” block. Click the stack to test. Cool! The sprite falls. To make the sprite fall over and over, place a “repeat” loop from the “control” menu around the “move” block. That works, but the sprite only falls part of the way down. The sprite should fall until it reaches the bottom. Replace the “repeat” block with a “repeat until” block. This block should read “repeat until the sprite is at the bottom of the stage.”

In other words, when the sprite’s y position is less than a number close to negative 180.

From the “operators” menu, add a “less than” block into the condition slot. Open the “motion” menu, and add a “y position” block on the left side. On the right side, type in a y position close to the bottom of the stage, like negative 170.

Drag the sprite towards the top of the stage, then click the block stack. Great! It falls until it reaches the bottom. Now, make the sprite start at a random spot at the top of the stage. Add a “go to” block to the top of the stack. Place a “pick random” block from the “operators” menu into the “x” value space, and type in negative 240 and 240. Type 180 in the “y” blank. Click the stack a few times to try this out.

Great! The sprite falls from a different spot each time.

Next, clone the sprite so that many objects fall. Open the “control” menu. Add a “forever” block. Inside it, place a “create clone of myself” block. Then, put a “when I start as a clone” block on top of the block stack that makes the sprite fall.

Test it out by clicking on the “forever” block stack. Wow! That sure is a storm!

It’s up to you to decide when you want the weather effect to happen. For example, place a “when flag clicked” block above the “forever” block to make the weather start at the beginning of the commercial, or make the effect happen with a “broadcast” block in your android sprite and a “when I receive” block above the “forever” loop in the weather sprite. Now, it’s time to tinker with this code to personalize the effect. If you think there are too many objects falling, add a “wait” block in the “forever” loop. Tinker with its value, or add a “pick random” block. Change the value in the “move” block to make the objects fall faster or slower, or use a “pick random” block to make them fall at random speeds. Add a “pick random” block in the “point in direction” block to make the objects fall in different directions.

To randomize the size of the falling objects, add “set size” and “pick random” blocks.

If you don’t want the objects to collect at the bottom of the stage, add a “delete this clone” block. To hide the original sprite, add a “hide” block after the starting event and a “show” block before the “repeat until” block.

This example has soft, fluffy snowflakes falling out of the sky, but your project might be totally different. You might create a rainstorm, hailstorm, or maybe even a food storm! Make this add-on yours. Here’s the Game Plan!

Add a new sprite that will fall from the sky. Make the sprite fall using the “point in direction,” “move,” “go to,” “less than,” “y position,” and “repeat until” blocks. Clone the falling sprite using the “create clone of myself,” “when I start as a clone,” and “forever” blocks.

Make this effect part of your commercial using either a “when flag clicked” block or the “broadcast” and “when I receive” blocks.

Tinker with and personalize your project.

Choose an Add-On
Happy Dance
Program the sprite to dance.
Changing Scene
Move the android through different scenes to see how the gadget reacts.
Weatherproof
Add weather effects to show how rugged the gadget is.
Purchase Decision
Ask the buyer to purchase the object.
Admiring Crowd
Add more sprites to the project to interact with the athlete.
Fitness Coach
Code the sprite to have a pulse and talk about its heart rate.
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!