Great job drawing a square! Now let's take it a step further and draw a triangle. A triangle has 3 sides and 3 corners — and just like the square, we can draw it using the Pen Extension and a simple loop.
A triangle has 3 equal sides and 3 corners. At each corner, the sprite turns 120°. Since 3 × 120° = 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.
- Make sure the Pen Extension is added. If not, click the Extensions button at the bottom left of the Code tab to add it.
Building the Script
Follow the steps below to build the script that draws a triangle. 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 (3) — Control
- Move (100) steps — Motion
- Turn (120) degrees — Motion
- Pen Up — Pen

Running the Script
- Click the green flag to run the script.
- Watch the sprite draw a triangle on the Stage!
- Click the green flag again at any time to redraw — the Erase All block will clear the previous drawing first.

Comparing Square vs Triangle
Square vs Triangle
Notice that no matter the shape, the total turning angle always adds up to 360°. This is the secret to drawing any regular polygon!
Customizing Your Triangle
- Change the pen color using the 'Set Pen Color to ()' block to make a colorful triangle.
- Change the pen size using the 'Set Pen Size to ()' block to make the lines thicker or thinner.
- Try changing the step count to make a bigger or smaller triangle.
Save your file with the name Draw a Triangle before moving on!

.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)