Clone sprites to create a pattern.
Open the Scratch starter project. Scratch will open in another browser tab.
You should see a shape sprite that looks a bit like a flower petal.
You will use
to create a pattern with this shape. You may remember creating my blocks
to organise your code in Nature Rover, and to repeat the same code in Puzzle Room. my blocks
can also be used to reuse actions in a different way.My blocks
Go to
and name your blocks (we have called it My blocks
pattern:
). Add repeat
as a label to identify the first input or what programmer call a parameter. Then click “Add an Input” to actually create the parameter called
.repeat
To design how a pattern is made, the first step is to define pattern
.
Drag the
parameter from repeat
into a define pattern
loop block.repeat
You will now use clone
blocks to make the same block appear a number of times. Make sure you also add code to change the size and position of the sprite, otherwise the sprites will be stacked on top of each other and you will not be able to see them.
Add some code into the
loop of your repeat
pattern
.
Tip: Defining
makes a general pattern outline. What you are creating now with my blocks
is similar to creating a spirograph stencil; it is the tool and the pattern is later created by using it.
Create a pattern with your my blocks
. Get the
to pattern
a number of times repeat
when flag clicked
.
Test: See what your pattern looks like by clicking the green flag to run your program.
You should see the beginning of a mandala pattern. Adding more parameters, or requirements, to your pattern will create the first part of your mandala.