This add-on will show you
how to make art elements appear randomly
in your Scratch project using the random block.
This example will make a circle sprite
appear randomly on the screen and change colors.
But you can use the random block in many
different ways, use your imagination!
First, make the sprite change colors forever.
You have created similar code in previous projects
like in paint with Terron day four.
Use the change color effect by 25 block
inside a forever loop to make the color keep changing.
Now make the sprite appear in a different
place each time it changes colors.
Drag out the go to xy block and
place it inside the forever loop.
Using this block you can specify
exactly where the sprite will show up.
Remember, you can see the x and y
coordinates of any position on the
stage by hovering over that position with
the mouse and looking at the coordinates
printed in the lower right corner of the stage.
Since the sprite should appear
in a random place each time,
use the pick random block found under operators.
You need two pick random blocks,
one for the x value and another for the y value.
Drag them both out and place them
inside the value spaces in the go to block.
Change the values for the first pick random block
to negative 240 and 240 to represent
the left and right edges of the screen.
Change the values for the second pick random block
to negative 170 and 170 to represent
the top and bottom of the screen.
Now, try running your code.
Wow!
The sprite do jumps all over the screen
and changes colors really fast!
Next, add a stamp block to make the circle
leave a stamp in each place it appears.
Awesome, be sure to add an event
to tell the sprite when to start.
Now it's your turn.
Use go to xy and pick random blocks to make
the sprite appear randomly throughout your project.
Be creative and incorporate your own ideas.