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 avalue. These values are called parameters. For example, the "print prepare" procedurehas 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 thespacing of the pattern changes. Making the first value larger increases the horizontalspace between the stamps. Making the second value larger increases the vertical spacebetween the stamps. Experiment with these values until you like the spacing of yourpattern. Now that you understand how parameters work,you're going to add another parameter to the "Print Prepare" procedure. Right-click onthe "define print prepare" block, and choose "edit" from the menu. Click on the optionsdropdown, then click the button next to "add number input." The value "number1" will beadded to the block, but type the word "size" in this block instead. Click “OK.”
The "define Print Prepare" block now has an extra parameter called "size," and the "PrintPrepare" block in the code now has a 3rd parameter value with a "1" showing in it. However, ifyou run the code, nothing new happens. The parameter for “size” exists, but you alsoneed 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 block into the "set size to" block. Now, your codewill automatically set the size of the sprite to the specifications in the "Print Prepare"block. Test your code. It creates a pattern withtiny versions of the sprite because the "size" parameter is set to 1. Make this parametera larger number to stamp bigger sprites. Experiment with the horizontal space, vertical space,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 you like. Imaginehow long it would take to paint each of these different versions of the pattern individuallyif you didn't know how to create them using computer science! Once again, knowing a littlecomputer science provides you with a way to easily envision your creation.
(say these steps slowly) You can also reuse the "print prepare" procedure to build anentirely new pattern quite easily. To do this, duplicate the code stack, change the keypressevent, 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 horizontaland 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, key presses, details, and any other information you can think of thatwill help Scratch community members enjoy and use your project.
Now, it's your turn! Right-click and edit the "define print prepare" block, click theoptions button, and add “spacing” and "size" parameters. Add a "set size to" blockto the "define print parameter" code, and add the "size" parameter to it. Experimentwith different parameter values until you have a pattern you like. You can also chooseto duplicate the code and use it to create an entirely new pattern.