How to make a game in Scratch
Scratch is a free block-coding tool, made at the MIT Media Lab and now run by the nonprofit Scratch Foundation. You build on the Scratch website or in the Scratch app by snapping blocks together. This tutorial makes a catch game: move the cat, catch apples, dodge a bomb, win at 10 points.
Build a catch game, step by step
- 1. Set up. Go to scratch.mit.edu and click Create. The cat sprite is your player. Pick a backdrop from the bottom-right corner.
- 2. Arrow-key movement. On the cat, add "when green flag clicked", then "forever". Inside it: "if key right arrow pressed then change x by 10", and the same for left with -10.
- 3. Add a falling apple. Add the Apple sprite. On green flag, "go to x: (pick random -220 to 220) y: 170", then forever "change y by -5". If its y position is below -170, send it back to the top.
- 4. Make a score. In Variables, click Make a Variable and name it score. Set it to 0 on green flag. In the apple's loop, "if touching Cat" then "change score by 1" and send the apple back to the top.
- 5. Win. On the cat: "wait until score = 10", "say You win! for 2 seconds", then "stop all".
- 6. Lose. Duplicate the apple, paint a bomb in its Costumes tab and remove the score blocks. If it touches the cat: "say Game over" and "stop all".
- 7. Share. Sign in, give the project a title and click Share. Anyone can now play it on the Scratch website.
Make it feel better
Speed up the falling apple as the score grows, for example "change y by (-5 - score / 2)", so the last points feel tense. Add a sound such as Pop from the library and play it with "start sound" on every catch. Add a second variable, time, that counts down from 30 so there is a reason to hurry. Small touches like these make a ten-block game feel like a real one.
Playing it on a phone
Scratch projects run in a web browser, so a shared game can be played on a phone. Building is another story: Scratch is made for computers and tablets, not phone screens. Phones also have no arrow keys, so add two button sprites on screen with "when this sprite clicked" to move the cat.
If you want a game made for the phone from the start, describe the same idea to Roam on iPhone, for example "catch apples, dodge bombs, 10 to win". It comes back playable with art and sound, and you change it by asking.
Make the phone version with Roam
Same idea, no blocks: describe it on your iPhone and play it the same day, alone or with friends.
Try: "catch falling apples in a basket, dodge bombs, speeds up every 5 points, first to 10 wins, 2 players"Questions people ask
Is Scratch free?
Yes. Scratch is free, run by the nonprofit Scratch Foundation. You build on the website or in the free Scratch app, which also works offline.
Can you make a Scratch game on a phone?
You can play shared Scratch projects on a phone, but Scratch is made for building on a computer or a tablet.
What age is Scratch for?
Scratch is designed for ages 8 to 16, though anyone can use it. ScratchJr is the version for ages 5 to 7.
Keep exploring
- How to make a clicker game
- How to make a game for kids, and with kids
- How to make a 2D game
- How to make a game on your phone
- How to make a game on iPhone
- How to make a horror game that actually scares people
More on Roam: All Roam games Games to play, by kind