Please update your browser
Your browser version is not supported by this site. CS First may not work properly. Learn more.
(Instructor) In this video you'll create a procedure
to reset the pattern printer, so it is ready to print again
when the one key is pressed.
The code stack that does this is already included
in this starter project.
This code has quite a few steps,
but essentially it just clears the 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 the project.
Remember, a procedure is a set of instructions
that performs a task.
A procedure can 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 describes
what the block will due, like reset project.
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
to the start of the key press events.
Now it's your turn.
Make a block called reset project.
Add the define block to the code stack
that clears the pattern.
Place the newly created reset project block
under the when one key pressed block.
In the next video you'll learn how to adjust
the size and spacing of your printed pattern
and change the sprite use to make the pattern.