Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

3. Usa un'altra fantasia


In this video, you will create a procedure to reset the pattern printer so it is ready to print again when the “1” key is pressed. The code stack that does this is already included in the 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 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 to the 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 the code stack that clears the pattern. Place the newly created "reset project" block under the "when 1 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 used to make the pattern.

arrow_backward Indietro
Avanti arrow_forward
  1. Crea una procedura per ripristinare i progetti.
  2. Utilizza una procedura per ripristinare i progetti.