Maths, coding, AI & parents
Scratch programming for kids: your first game in 20 minutes
A free beginner tutorial for Scratch, the block coding tool for children aged 8 and up. Make a cat move, then a simple catch-the-apple game with a score, with each block explained for parents and kids.
Scratch is a free visual programming tool from MIT. Instead of typing code, children snap colourful blocks together to make stories, animations and games. It is aimed at ages 8 to 16 (younger children can start with ScratchJr on a tablet). This tutorial walks through two small projects. You do not need any coding experience, and you can sit next to your child and learn together.
Before you begin
- Open scratch.mit.edu in a browser on a laptop or computer and click Create. You can use it without an account, though you need a free account to save projects online. Scratch also has an offline version you can download.
- Look at the screen. The Stage (top right) is where things happen. The block palette (left) holds the blocks, grouped by colour and name: Motion, Looks, Sound, Events, Control, Sensing, Operators, Variables. The Code area (middle) is where you drag blocks to build a script.
Project 1: Make the cat move
Goal: the cat walks across the stage and bounces off the edge.
- From Events (yellow), drag when green flag clicked into the Code area.
- From Control (orange), drag forever and snap it under the first block.
- From Motion (blue), drag move 10 steps inside the forever block.
- From Motion, drag if on edge, bounce inside the forever block, under the move block.
- Click the green flag above the stage. The cat walks and bounces.
What did your child just learn?
- Event: something that starts the script (the green flag).
- Loop: the forever block repeats instructions.
- Sequence: blocks run from top to bottom.
Try changing it. Change 10 to 20. What happens? Add the Looks block next costume inside the loop and the cat's legs will move. Add play sound meow until done. Ask your child to predict before pressing the flag.
Project 2: Catch the apple (with a score)
Goal: an apple falls from the top. Move the bowl left and right to catch it. Each catch adds a point.
Step 1: Set up the sprites
- Delete the cat (click the bin on its thumbnail).
- Click Choose a Sprite (the cat-face button at the bottom right) and pick Bowl (or any sprite you like) and Apple. If you can't find them, choose any two, such as a basket-like sprite and a ball.
- Click Choose a Backdrop and pick anything you like.
Step 2: Make a score
- Click Variables and then Make a Variable. Name it score. Leave "For all sprites" selected and click OK. A "score" counter appears on the stage.
Step 3: Move the bowl with the arrow keys
Select the bowl sprite. Make two small scripts:
- when right arrow key pressed (Events) โ change x by 15 (Motion)
- when left arrow key pressed (Events) โ change x by -15 (Motion)
Press the arrow keys and the bowl should slide.
Step 4: Make the apple fall
Select the apple. Build this script, block by block:
- when green flag clicked (Events)
- set score to 0 (Variables)
- go to x: (pick random -200 to 200) y: 170 (Motion for "go to", Operators for "pick random")
- forever (Control) and inside it:
- change y by -5 (Motion)
- if touching Bowl? then (Control + Sensing)
- change score by 1 (Variables)
- go to x: (pick random -200 to 200) y: 170
- if y position < -170 then (Control + Operators + Motion)
- go to x: (pick random -200 to 200) y: 170
Press the green flag and play! Each catch adds a point, and a missed apple goes back to the top.
What your child learned
- Variables: score remembers a number.
- Conditions: if touching the bowl, do something.
- Coordinates: x goes left and right, y goes up and down. This is the same idea as the graphs in school maths.
- Random numbers: the apple falls in a different place each time.
Level up: ideas for next time
- Make the apple fall faster as the score gets higher (change y by a bigger negative number when score > 5).
- Add a second apple that costs a point when caught.
- Add a "Game over" message when the apple hits the bottom three times.
- Draw your own sprite in the Paint editor.
Tips for parents
- Let your child drive. Sit beside them, ask questions ("what do you think will happen?"), and resist taking the mouse.
- Expect bugs. Debugging, finding and fixing mistakes, is where the learning happens. Say "interesting, why do you think it did that?"
- Keep sessions short. Thirty to forty minutes is plenty at first.
- Save and share. Log in and click File โ Save now so your child can show family their project.
What next after Scratch?
When your child is comfortable (and typing is easier), try our free coding games or read about Scratch vs Python. Many children move to Python around ages 10 to 12. If your child would like a teacher to guide them, see our coding classes for kids.
Common questions
Is Scratch free?
Yes. Scratch is a free project of the MIT Media Lab's Lifelong Kindergarten group. You can use it in a browser, and an offline editor is also available.
What age is Scratch for?
It is designed for ages 8 to 16. Younger children can try ScratchJr, which is a simpler tablet app for ages 5 to 7.
Do kids need an account?
No, to try it. A free account lets children save projects online and share them.
Is Scratch "real" coding?
Yes. It teaches the same ideas as text-based languages: sequences, loops, conditions, variables and events. Many programmers started with it.
Is Scratch available in Hindi?
Scratch has a language menu (the globe icon) with many languages, including Hindi and other Indian languages. The interface language can be changed without changing the project.
Should my child learn Scratch or Python first?
For ages 8 to 10, Scratch is a gentle start. For ages 11 and above, or after Scratch, Python is a good next step. See Scratch vs Python for kids.
This guide is general information. For exams, follow your school, teacher and official exam board, and use your own judgement about what suits your child.