In this video,
you'll learn how to adjust the size
and spacing of your printed pattern
and change the sprite used to make the pattern.
When a procedure is called, it can send a value.
These values are called parameters.
For example, the Print Prepare procedure
has two parameters called horizontal space
and vertical space.
If you adjust the values in the Print Prepare block
and run the code, you'll see that
the spacing of the pattern changes.
Making the first value larger
increases the horizontal space between the stamps.
Making the second value larger increases
the vertical space between the stamps.
Experiment with these values
until you like the spacing of your pattern.
Now that you understand how parameters work,
you're going to add another parameter
to the Print Prepare procedure.
Right-click on the define Print Prepare block
and choose Edit from the menu.
Then click the button add number input.
Type the word size in this block, click OK.
The define Print Prepare block
now has an extra parameter called size
and the Print Prepare block in the code
now has a third parameter value.
However, if you run the code, nothing new happens.
The parameter for size exists, but you also need
to instruct the define block how to use that parameter.
Click the Looks menu, select the set size to block
and place it under the define block.
Then drag the size parameter into the set size to block.
Now, your code will automatically set the size of the sprite
to the specifications in the Print Prepare block.
Test your code.
It creates a pattern with tiny versions of the sprite
because the size parameter is set to one.
Make this parameter a larger number to stamp bigger sprites.
Experiment with the horizontal, vertical,
and size parameters until you get a pattern you like.
Using a procedure like Print Prepare
makes it easy to experiment with lots of different values
and create something that you like.
Imagine how long it would take to paint
each of these different versions of the pattern individually
if you didn't know how to create them
using computer science.
Once again, knowing a little computer science
provides you with a way to easily envision your creation.
You can also reuse the Print Prepare procedure,
build an entirely new pattern quite easily.
To do this, duplicate the code stack.
Change the keypress event.
Add a new costume.
And set the switch costume block to that new costume.
The Print Prepare procedure allows you to change
the size of the sprite and the horizontal
and vertical spacing of the new pattern
without changing your original pattern.
The project page helps other Scratch users
get to know your project and how to use it.
Add instructions, keypresses, details,
and any other information you can think of
that will help Scratch community members
enjoy and use your project.
Now it's your turn.
Right-click and edit the define Print Prepare block,
click the options button,
and add sizing and space parameters.
Add a set size block to the define print parameter code,
and add the size parameter to it.
Experiment with different parameter values
until you have a pattern you like.
You can also choose to duplicate the code
and use it to create an entirely new pattern.
Sign in to track your progress and earn badges