In this add-on, you’ll program a weather feature for your project.
To start, add or draw a new sprite that will fall from the sky.
This example adds a snowflake, but you can add anything you like.
Use the shrink tool to make the sprite fit properly on the stage.
Next, program the sprite to fall from the sky.
Add a “go to x-y” block to the scripts editor, then drag out a “pick random” block.
To make the sprite start from a random spot at the top of the screen, put the “pick random” block inside the x value of the “go to x y” block.
Type negative 240 and positive 240 in the value spaces in the “pick random” block to represent the far right and far left edges of the stage.
In the “y” value, type in 180, which is the top of the stage.
Test it out.
To make the object fall, add a “change y” block, and enter a negative value.
The object should fall until it reaches the bottom of the stage, so add a “repeat until” loop around the “change y” block.
Add a “less than” operator in the condition field.
Put a “y position” block from the “motion” menu on the left side, and enter a y value on the right side in a spot close to the bottom of the stage, like negative 170.
Test it out.
Now, add more snowflakes by cloning this sprite.
Add a “when flag clicked” event, then a “forever” loop, and put “create clone of myself” and “wait” blocks inside it.
Tinker with the value in the “wait” block to make the sprite fall more or less frequently.
Then, add a “when I start as a clone” block to the top of the “go to x-y” block.
Test it out!
Cool! The sprites fall in a flurry.
To delete the clones when they reach the ground, add a “delete this clone” block under the “repeat until” block.
Feel free to add a “wait” block before the “delete this clone” block to delay the sprite disappearing.
You could also add clouds to cover the sprites’ starting point, to make it look like it’s storming.
Consider adding a “go back layers” block, a “set size” block, and “pick random” blocks to make this look even more realistic.
This way, some clones fall behind the android, and some fall in front of it.
The clones also vary in size.
Now, it’s your turn.
Add a new sprite that will fall from the sky.
Program the sprite to fall and clone itself.
Customize the sprite’s falling using more “pick random” and “wait” blocks, a “go back layer” block, and a “set size” block.