Scratch 10 · Create your own arcade game

Falling stars approach a sideways-moving paddle inside a retro arcade cabinet.

Scratch lesson 10 of 10 · Intermediate · About 50–60 minutes

Build a catch-and-dodge arcade project, then use a custom block with a speed input to make the game harder as the score rises.

What you’ll make Make a playable arcade game. Catch six falling stars to win before three escape, with a faster drop after the third catch.

Get ready

Open the Scratch editor (opens in a new tab) and start a new project.

  • Start a new Scratch project. Paint a wide paddle about 80 pixels across and 16 pixels high, centred over the crosshair in the Costumes editor. Name the sprite Paddle. Paint or choose a small star and call it Star.
  • Make three Stage backdrops called Arcade, You win and Try again. Add a short replay instruction to each ending backdrop. Make Score and Misses in Variables for all sprites so the Stage and both sprites can read them.

To keep your project, choose File → Save to your computer in Scratch.

Start a round. Reset the game state. → Use a custom block. Give it an input. → Test and improve. Check the game rules.
Project flow · Start a round → Use a custom block → Test and improve

Build it in Scratch

Choose the sprite named above each stack. The colours help you find the block categories. Indented rows sit inside the block above. Follow the end marker to see where each loop or condition closes.

1. Reset the score and choose the opening screen

Select the Stage and add the starting script. Create the Get ready and Play broadcasts from the Events menu. The first message sets the sprites up. The second starts the code for the falling star and the paddle together.

Block stack for Stage
when green flag clicked
switch backdrop to [Arcade]
set [Score] to (0)
set [Misses] to (0)
broadcast [Get ready] and wait
broadcast [Play]

2. Put the paddle and star in their starting states

Give each sprite a short receiver for Get ready. Put the first script on Paddle. Put the second on Star so a star left over from the previous game is hidden until the next drop. The gap in the block diagram separates the two scripts.

Block stack for Paddle, then Star
when I receive [Get ready]
go to x: (0) y: (-135)
show
when I receive [Get ready]
hide

3. Slide the paddle left and right

On Paddle, add a Play receiver. Each direction requires the correct arrow key and enough room to move. Use the two green comparison blocks inside the green and blocks. The loop stops when you win or run out of chances.

Block stack for Paddle
when I receive [Play]
repeat until <<(Score) = (6)> or <(Misses) = (3)>>
if <<key [left arrow] pressed?> and <(x position) > (-184)>> then
change x by (-6)
↳ End of block
if <<key [right arrow] pressed?> and <(x position) < (184)>> then
change x by (6)
↳ End of block
↳ End of block
hide

4. Make a custom block that drops one star

Select Star. In My Blocks, choose Make a Block and name it drop at speed. Choose Add an input (number or text), name it speed and leave Run without screen refresh unticked. Under the new define block, drag the speed input from the hat into the subtraction block. Each call drops one star from a random position. It checks whether it hit Paddle or went below it, then adds exactly one catch or one miss.

Block stack for Star
define drop at speed (speed)
go to x: (pick random (-170) to (170)) y: (145)
show
repeat until <<touching [Paddle]?> or <(y position) < (-155)>>
change y by ((0) - (speed))
↳ End of block
if <touching [Paddle]?> then
change [Score] by (1)
else
change [Misses] by (1)
↳ End of block
hide

5. Speed up after three catches

Still on Star, add a separate script that calls the custom block. Drag it from My Blocks twice. Type 4 in the first caller and 7 in the second. The number you pass becomes speed while the block runs. Each drop finishes before the repeat loop starts another one.

Block stack for Star
when I receive [Play]
repeat until <<(Score) = (6)> or <(Misses) = (3)>>
if <(Score) < (3)> then
drop at speed (4)
else
drop at speed (7)
↳ End of block
↳ End of block
broadcast [Game over]

6. Finish and replay

On the Stage, add the Game over receiver. Use the score to choose the ending. The star has already hidden itself after its last drop and the paddle hides when its loop ends. Use the flag to reset both counters and try again.

Block stack for Stage
when I receive [Game over]
if <(Score) = (6)> then
switch backdrop to [You win]
else
switch backdrop to [Try again]
↳ End of block

Test your project

  1. Temporarily replace the random x block in Star's custom block with 0. Leave Paddle in the middle to test six catches. Watch the drops get quicker after the third catch.
  2. Restart with the same test position. Move Paddle well to one side and check that three stars count as three misses and show Try again. Restore the random x block afterwards.
  3. Click the flag during a drop. Check that both numbers go back to zero and Paddle returns to the middle.
  4. Ask someone else to play. See whether they can explain the controls and work out when the star gets faster.

If something goes wrong

The star jumps to its final position.
Edit your custom block and make sure Run without screen refresh is unticked. This gives Scratch time to draw each falling step.
Both difficulty settings feel the same.
Check that your change-y block uses 0 minus the oval speed input from define. The two callers should pass 4 and 7.
The star reaches the paddle but a catch is missed.
Check that Sensing says touching Paddle and that the Paddle costume is centred. Use the fixed x test to check a drop directly above it.

Make it your own

  • Change the artwork to make it your own. Try a fishing boat catching drops, or a tray catching cupcakes.
  • Make a gentle mode that passes 2 and 4 as the drop speeds. Play each version and choose which one is better for a first-time player.

What you’ve learned A custom block names a job that your program can reuse. An input lets you change how it runs each time without rewriting the blocks inside.