Use scratch to build a random art generator
Green highlight

Use Scratch to build a random art generator that creates colorful patterns with sprites, shapes, and code blocks, learning programming and creative experimentation.

Orange shooting star
Download Guide
Collect Badge
Background blob
Challenge Image
Skill Badge
Table of contents

Step-by-step guide to build a random art generator with Scratch

Here at SafeTube, we're on a mission to create a safer and more delightful internet. 😊

How to Make a Drawing Game in Scratch | Art Simulator Tutorial

What you need
Scratch account or scratch offline editor

Step 1

Open Scratch and start a new project.

Step 2

Click the blue Extensions button and add the Pen extension.

Step 3

Create a brush sprite by clicking Paint and drawing a small filled circle.

Step 4

Select the brush sprite in the sprites list.

Step 5

Drag a "when green flag clicked" hat block into the brush sprite’s scripting area.

Step 6

Attach a "clear" block directly under the hat block.

Step 7

Attach a "go to x: 0 y: 0" block under the clear block.

Step 8

Attach a "pen down" block under the go to block.

Step 9

Attach a "set pen size to 4" block under the pen down block.

Step 10

Attach a "repeat 200" block under the pen size block.

Step 11

Put a "set pen color to (pick random 1 to 200)" block inside the repeat loop.

Step 12

Put a "move (pick random 5 to 20) steps" block inside the repeat loop.

Step 13

Put a "turn 15 degrees" block inside the repeat loop.

Step 14

Click the green flag to run your random art generator and watch the colorful pattern form.

Step 15

Share your finished Scratch project on DIY.org.

Final steps

You're almost there! Complete all the steps, bring your creation to life, post it, and conquer the challenge!

Complete & Share
Challenge badge placeholder
Challenge badge

Help!?

What can we use instead if we can't add the Pen extension or can't paint a brush sprite?

If you can't add the Pen extension or paint a brush sprite, choose a built‑in round sprite or draw a small filled circle and use the 'stamp' block inside the repeat loop instead of 'pen down' to leave marks.

Why doesn't any art appear when I press the green flag and how do I fix it?

If nothing draws when you click the green flag, make sure you added the Pen extension and that the brush sprite's script starts with 'clear', 'go to x: 0 y: 0', and a 'pen down' and 'set pen size to 4' placed before the 'repeat 200' loop.

How can I change the activity to suit younger or older kids?

For younger kids change 'repeat 200' to 'repeat 50' and fix 'move' to a small number so they see results quickly, while older kids can replace 'turn 15 degrees' with 'turn (pick random -90 to 90) degrees' and add 'change pen size by (pick random 1 to 5)' inside the loop.

How can we make the generator more interesting or personalize our design?

To personalize the generator add a second painted brush sprite with its own script using 'set pen size to 8' and a different 'turn' value or create a stage variable slider that sets the 'set pen size to' or 'repeat' value before clicking the green flag.

Watch videos on how to build a random art generator with Scratch

Here at SafeTube, we're on a mission to create a safer and more delightful internet. 😊

How to MAKE ITEM RANDOMIZER ON SCRATCH 2020

4 Videos

Facts about Scratch programming for kids

🎨 Generative art uses rules and algorithms so the same program can produce endless different artworks.

🧩 In Scratch, sprites can draw by using pen blocks or stamp shapes to build colorful designs.

🔁 Random number blocks, when combined with loops and motion, can create surprisingly complex patterns.

🐱 Scratch was created by the MIT Lifelong Kindergarten Group and was first released in 2007.

🌈 Small changes to hue, brightness, or transparency can turn simple shapes into rich, layered patterns.

How do you build a random art generator in Scratch?

Start a new Scratch project, add the Pen extension, and create a main sprite to control drawing. Use loops and the “create clone of” block to make repeated patterns; set pen color to pick random numbers, and choose random positions, directions, sizes, or shapes. Use broadcasts or clickable sprites to start/stop and the clear command to reset. Test, tweak randomness ranges, and add sliders or buttons so kids can experiment with parameters and see immediate visual feedback.

What materials do I need to make a Scratch random art generator?

You need a computer, Chromebook, or tablet with internet access (or Scratch Desktop offline). Open an account on scratch.mit.edu or use the offline editor, and a mouse or touchscreen for drawing controls. Optionally prepare a simple worksheet with ideas (color palettes, shape lists) and headphones for tutorial videos. No physical craft supplies required unless you want to print results or sketch ideas on paper.

What ages is this Scratch activity suitable for?

This activity suits children about 7–12 years old: younger kids (7–9) benefit from adult guidance for blocks and pen control, while older kids (10–12) can design features, add variables, and debug independently. Teens and beginners of any age can extend it with math, cloning patterns, or sound. Adjust complexity: use simple start/stop buttons for young children and introduce variables, lists, and custom blocks for older learners.

What are the benefits of building a random art generator in Scratch?

Creating a random art generator teaches programming basics—loops, variables, conditionals, and cloning—while fostering creativity and experimentation. Kids learn cause-and-effect by adjusting parameters and seeing visual results, practice problem-solving through debugging, and gain confidence from designing interactive projects. It also reinforces math skills (coordinates, angles, randomness) and encourages iteration: kids improve patterns by testing and tweaking code.
DIY Yeti Character
Join Frame
Flying Text Box

One subscription, many ways to play and learn.

Try for free

Only $6.99 after trial. No credit card required

Use scratch to build a random art generator. Activities for Kids.