In this video, you will create a procedure to reset the pattern printer so it is readyto print again when the “1” key is pressed. The code stack that does this is already includedin the starter project. This code has quite a few steps, but essentially it just clearsthe pattern and prepares the project to start over.
To start, turn this code into a procedure that can be called at any time to reset theproject. Remember, a procedure is a set of instructions that performs a task. A procedurecan be "called" at any point in the program to carry out that set of instructions.
From the "more blocks" menu, select "make a block." Name this block something that describeswhat the block will do, like "reset project." Click “OK.”
This automatically adds a "define" block to your scripting area. Drag the “define”block onto the code that resets the pattern. You now have a procedure that resets the pattern.
But, to use it, you’ll need to “call” it by adding the new block you created tothe start of the keypress events. Stuck? Ask the person next to you for help.
If you can’t figure it out together, ask your Guru.
Now, it's your turn! Make a block called "reset project." Add the “define” block to thecode stack that clears the pattern. Place the newly created "reset project" block underthe "when 1 key pressed block."
In the next video, you'll learn how to adjust the size and spacing of your printed patternand change the sprite used to make the pattern.