Ever wanted to create all equilateral polygons in Scratch using just a few blocks?
This beginner tutorial shows how the same small set of blocks can generate shapes like triangles, squares, and pentagons. Using the Pen extension, variables, and sliders, the code becomes an interactive shape-drawing tool.
This post supports the video tutorial below by explaining the ideas behind the project and walking through the code step by step.
To draw an equilateral shape in Scratch, the turning angle must be calculated. Here’s the formula:
Turning angle = 360° ÷ number of sides
This tells the sprite how much to turn after drawing each side. For example:
Once the angle is set, the sprite simply moves forward and turns, repeating these steps for each side.
To make the code more fun and interactive, create these three variables and turn them into sliders:
Then use a repeat loop to draw the shape.
By placing everything inside a forever loop, the shape updates automatically as the sliders are moved.
This project may look simple, but it highlights what real coding is about: creating smart, reusable code that adapts.
Problem | What to Check |
---|---|
Shape doesn’t close | Make sure the sprite turns 360 ÷ sides degrees and repeats the correct number of times. |
Old shapes stay on screen | Use the erase all block before each new drawing |
Sliders don’t work | Check that the variables are used inside the drawing code |
For those interested in expanding this project and creating something more advanced, the post below is the perfect next step.
If you’re interested in more projects like this, be sure to check out our YouTube channel, where we regularly share new tutorials to help you explore, learn, and create with Scratch.