Now that you know about the Pen Extension and how shapes work, it's time to put that knowledge into action! In this activity, we will use PictoBlox to draw a square on the Stage.
A square has 4 equal sides and 4 corners. At each corner, the sprite turns 90°. Since 4 × 90° = 360°, the sprite completes a full turn and the shape closes perfectly.
Setting Up
- Open PictoBlox and create a New File.
- Select Block Coding as the coding environment.
- Add the Pen Extension by clicking the Extensions button at the bottom left of the Code tab.
- Hide the default sprite or move it out of the way so it doesn't obstruct the drawing.
Building the Script
Follow the steps below to build the script that draws a square. You will find the blocks in the mentioned palettes:
- When flag clicked — Events
- Erase All — Pen
- Go to x: (0) y: (0) — Motion
- Pen Down — Pen
- Repeat (4) — Control
- Move (100) steps — Motion
- Turn (90) degrees — Motion
- Pen Up — Pen

Running the Script
- Click the green flag to run the script.
- Watch the sprite draw a square on the Stage!
- If you want to redraw, simply click the green flag again — the Erase All block will clear the previous drawing first.

Customizing Your Square
Try experimenting with the following to make your square more interesting:
- Change the pen color using the 'Set Pen Color to ()' block.
- Change the pen size using the 'Set Pen Size to ()' block to make the lines thicker or thinner.
- Change the step count (e.g. 150 steps) to make a bigger or smaller square.
Save your file with the name Draw a Square before moving on to the next activity!

.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)