In this add on,you will add some weather to your commercialto demonstrate that the gadget worksin 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 libraryor 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 blockand select down.
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 menuaround 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 spriteis at the bottom of the stage.
In other words, when the sprite's y positionis less than a number close to -180.
From the operators menu, add a less than blockinto the conditions slot.
Open the motion menu and add a y position blockon the left side.
On the right side, type in a y position closeto the bottom of the stage like -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 spotat the top of the stage.
Add a go to block to the top of the stack.
Place a pick random block from the operators menuinto the x value space and type in -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 clone blockon 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 decidewhen you want the weather effect to happen.
For example, place a when flag clicked blockabove the forever block to make the weather startat the beginning of the commercialor make the effect happen when the broadcast blockand your android sprite and a when I receive blockabove the forever loop in the weather 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 pick random block.
Change the value in the move blockto make the objects fall faster or slower.
Or use a pick random block to make them fallat random speeds.
Add a pick random block and the point in direction blockto 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 collectat the bottom of the stage, add a delete this clone block.
Finally, to hide the original sprite,add a hide block after the starting eventand a show block before the repeat until block.
This example has soft, fluffy snowflakesfalling 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.
Alright here's the game plan.
First, add a new sprite that will fall from the sky.
Next, 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 the effect part of your commercialusing either a when flag clicked blockor the broadcast and when I receive blocks.
Finally, tinker with and personalize your project.
Choose an Add-On
Move the android through different scenes to see how the gadget reacts.