In this add-on, you will add some weather to your commercial to demonstrate that thegadget works in even the most extreme conditions. Start by adding a new sprite. This will bethe sprite that falls from the sky, whether it be rain, snow, or cats and dogs. You caneither choose a sprite from the library, or draw your own. This example uses a small whitecircle to represent snow. Go to the scripts tab of the sprite you justcreated. 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! Thesprite falls. To make the sprite fall over and over, placea “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 reachesthe bottom. Replace the “repeat” block with a “repeatuntil” 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. Openthe “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 fallsuntil it reaches the bottom. Now, make the sprite start at a random spotat the top of the stage. Add a “go to” block to the top of the stack. Place a “pickrandom” block from the “operators” menu into the “x” value space, and type innegative 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 Istart 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, placea “when flag clicked” block above the “forever” block to make the weather startat the beginning of the commercial, or make the effect happen with a “broadcast” blockin your android sprite and a “when I receive” block above the “forever” loop in theweather sprite. Now, it’s time to tinker with this codeto 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 “pickrandom” block. Change the value in the “move” block tomake the objects fall faster or slower, or use a “pick random” block to make themfall at random speeds. Add a “pick random” block in the “pointin 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 “deletethis 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 betotally different. You might create a rainstorm, hailstorm, or maybe even a food storm! Makethis 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 indirection,” “move,” “go to,” “less than,” “y position,” and “repeat until”blocks. Clone the falling sprite using the “createclone 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 orthe “broadcast” and “when I receive” blocks.
Tinker with and personalize your project.
Choisir une extension
Programmer le lutin pour qu'il danse.
Changement de scène
Fais passer l'androïde sur différentes scènes pour voir comment le gadget réagit.
Ajoute des effets météorologiques pour montrer la solidité du gadget.
Demande à l'acheteur d'acheter l'objet.
Ajoute au projet d'autres lutins qui interagiront avec l'athlète.
Code le lutin pour lui ajouter un pouls et pour le faire parler de son rythme cardiaque.