Contact details
Digital Circus
Ian Kenny

503 Queen Street West

Hastings

0212255459

06 8767028

ian.kenny@digitalcircus.org.nz

Proudly Supported By

Drawing shapes!

In this task, students will demonstrate knowledge of:

- Sequential algorithms​

- Events

- Iteration / loops

Activity:

To create a program that can draw a square.

In this project, we are going to be using the pen tool. We are going to be coding the scratch cat to draw a square. All of the code we write will go on our cat.

Step one:

We need to make sure our pen is ready to use when we press the green flag.

In the events category, you will find the “when green flag pressed” block, drag and drop that into our coding area. Next, from the pen category attach the “pen down” block to our code.

Step two:

Let's get our cat to draw the top line of our square. In the motion category, you will find the “move” block, you can change the number on that block so that the cat will move further.

After the cat has drawn the top line he then needs to turn 90 degrees to be ready to draw the next line. In the motion category, you will find 2turn” blocks.

One turns clockwise and the other turns anti-clockwise, either is fine.​

Add these 2 blocks to your code and test!!

Step three:

Now, we could go ahead and pull out those 2 blocks over and over again until our code tells our cat to draw a square OR, we could use just 1 block!

 

In the control category, you will find blocks that will loop/repeat code that is inside of it.

 

We are going to use the “repeat” block. We want to repeat our code FOUR times to make a square.

 

Apply the “repeat” block and test!

Good job!!

 

Your cat should draw a square each time you press the green flag.

Do you notice a problem or something we should change?

Step four:

To tidy our code up we need to make sure the cat clears all the drawings off of the screen at the start for a clear canvas and lifts the pen off of the page when it's done drawing.

 

You will find both the “clear” and the “pen up” blocks in the pen category. Add the “clear” block to the beginning of our code and the “pen up” block at the end.

Good job!!

Your cat should clear the space,

then draw a new square each time

you press the green flag.

Before you leave...

Mini challenge one:

Change the colour and size of the pen.

Mini challenge two:

Change the size of the square.