Catch the Falling Stars in Scratch
Build a Scratch catching game with keyboard controls, falling stars and a score.
Introduction
30 Second Summary
A game loses its pull when the player can only watch. The fun starts when every key press changes what happens next.
In this project, you will build a space-themed catching game in Scratch. Players will steer a basket to catch falling stars for points.
What You'll Build
You will demo a replayable space game where a basket chases falling stars while the score climbs with every catch.
By the end of this project, you'll have:
- A keyboard-controlled basket that moves left or right when you press the matching arrow key.
- A falling star that returns at a random horizontal position after every catch or miss.
- A visible score that rewards every catch before returning to zero for a new game.
- Secret Mission: Add a faster asteroid that subtracts two points when it hits the basket.
Are there any prerequisites?
You need a Mac with internet access. A Scratch account is optional because you can save the project to your Mac.
Before We Start
Before any hands-on work begins, this is your moment to commit to the game you are making. Deciding what the player does gives every later choice a clear purpose.
Set Up the Game Stage
Your game idea now has a clear goal. The player moves a basket to catch falling stars for points.
A game needs recognizable pieces before its rules can come alive. The Scratch web editor gives you a place to create the player and the target.
In this step, get ready to:
- Load the Scratch web editor.
- Create two painted game pieces.
- Save a named local project.
Open the Scratch editor
The browser editor contains the workspace where every part of your game comes together. You can use it without installing another app.
- Enter scratch.mit.edu in your browser's address bar.
- Click Create on the Scratch homepage.
- Allow the editor to finish loading.
- Confirm that the Stage is visible.
- Confirm that the Code Area is visible.
- Confirm that the sprite list is visible.
You're in. The editor now has every workspace you need to assemble the game.
Editor not loading?
- Reload the browser tab.
- Check that your Mac is connected to the internet.
- Return to the Scratch homepage before selecting Create again.
Still stuck? Help me troubleshoot why the Scratch web editor is not loading. You can also ask the Scratch community.
Paint and place the sprites
A sprite is a game piece that can appear on the Stage. Clear shapes make the catcher and falling object easy to recognize.
- Select the default sprite in the sprite list.
- Click Delete in its controls.
- Select the paint option in the sprite controls beneath the Stage.
- Use the paint tools to draw a wide basket.
- Enter Basket in the sprite name field.
- Drag Basket near the bottom of the Stage.
Your catcher is now visible where the player expects to control it.
- Select the paint option in the sprite controls beneath the Stage.
- Use the paint tools to draw a yellow star.
- Enter Star in the sprite name field.
- Drag Star near the top of the Stage.
That's your scene taking shape. The basket waits below while the star starts above.
Why Do Names and Positions Matter?
Distinct names keep each game piece easy to identify when you add scripts later. Their positions also make the goal readable before anything moves.
Sprites Not Looking Right?
- Select the default sprite if it still appears in the sprite list.
- Click Delete in its controls.
- Correct either custom name in the selected sprite's name field.
- Resize either drawing with the paint tools if it is difficult to see.
Need a hand? Help me fix my painted Scratch sprites.
Name and save the project
A local .sb3 copy keeps the project on your Mac without requiring a Scratch account. Your browser may ask for download permission or a save location.
- Click the project title field at the top of the editor.
- Enter Catch the Falling Stars as the project name.
- Click File in the editor menu.
- Choose the option that saves a copy to your computer.
- Allow the download if your browser asks for permission.
- Choose a folder you can find again if your Mac asks for a save location.
- Allow the browser to finish downloading the project.
You should see a completed download named Catch the Falling Stars.sb3.
Before you make the final check, what do you expect the Stage and sprite list to show?
- Confirm that the project title reads Catch the Falling Stars.
- Confirm that Basket sits near the bottom of the Stage.
- Confirm that Star sits near the top of the Stage.
- Confirm that the sprite list contains only Basket and Star.
That is the stage set. Your basket and star are visible in their starting areas.
The completed .sb3 download confirms that your first local copy is safe on your Mac.
Local Copy Missing?
- Return to the File menu.
- Choose the local-save option again.
- Check your browser's completed downloads.
- Allow downloads from Scratch if your browser blocks the file.
Still missing the file? Help me save my Scratch project locally on my Mac.
Your game pieces are ready. Next, you'll make the basket respond to the arrow keys.
Move the Basket
Your painted Basket and Star turned the blank Stage into a recognizable game scene. The player still needs a way to control the Basket.
Scratch uses events to start scripts when something happens. The green flag gives the Basket a reliable starting point.
The arrow keys turn the static scene into your first playable game.
In this step, get ready to:
- Reset the Basket to the bottom center when the green flag is clicked.
- Move the Basket left with the left arrow key.
- Move the Basket right with the right arrow key.
Reset the Basket with the green flag
A green-flag event gives every play session the same starting state. Scratch coordinates place the Basket at an exact point on the Stage.
- Select the Basket in the sprite list below the Stage.
- Find the when green flag clicked block in the blocks palette.
- Drag when green flag clicked into an empty part of the Code area.
- Find the go to x: 0 y: -145 block in the blocks palette.
- Snap go to x: 0 y: -145 directly below the green-flag event.
- Drag the Basket to another position on the Stage.
- Click the green flag above the Stage.
The green-flag reset works. You will see the Basket jump to the bottom center.
Basket not resetting?
- Check that Basket is selected in the sprite list.
- Make sure go to x: 0 y: -145 is connected below when green flag clicked.
Still stuck? Help me fix my Basket reset script.
Add arrow-key controls
A keyboard event starts a script when the player presses its assigned key. A negative x change moves left.
- Find the when left arrow key pressed block in the blocks palette.
- Drag when left arrow key pressed into a separate part of the Code area.
- Find the change x by -20 block in the blocks palette.
- Snap change x by -20 below the left-arrow event.
- Press the left arrow key once.
You will see the Basket move one step to the left.
A positive x change moves right. The matching distance keeps both directions equally responsive.
- Find the when right arrow key pressed block in the blocks palette.
- Drag when right arrow key pressed into another empty part of the Code area.
- Find the change x by 20 block in the blocks palette.
- Snap change x by 20 below the right-arrow event.
- Press the right arrow key once.
Your player control now works in both directions. You will see the Basket move one step to the right.
The movement number controls the distance travelled with each keypress. You can compare another distance if the current movement feels too slow or too fast.
- Temporarily change the left motion value to another negative number if you want to compare its speed.
- Change the right motion value to the matching positive number.
- Press both arrow keys to compare the movement.
- Return the left motion value to -20.
- Return the right motion value to 20.
Arrow keys not moving the Basket?
- Check that both arrow-key scripts belong to the Basket sprite.
- Confirm that each motion block is connected to its matching keyboard event.
- Click the Stage before pressing the arrow keys again.
Need another pair of eyes? Help me troubleshoot my Basket controls.
Test the Basket movement
The Basket now has three independent scripts. Each script responds to its own event.
Before you run the full check, where do you expect the Basket to start? Which direction should each arrow key move it?
- Drag the Basket away from the bottom center of the Stage.
- Click the green flag.
- Press the left arrow key once.
- Press the right arrow key twice.
You will see the Basket reset to the bottom center. It moves left once before moving right twice.
✔️ My Basket resets and moves
Your Basket starts near the bottom center. Both arrow keys move it in the matching direction.
ⓧ I'd like to double-check all scripts
- Confirm the first stack has when green flag clicked with go to x: 0 y: -145 below it.
- Confirm the second stack has when left arrow key pressed with change x by -20 below it.
- Confirm the third stack has when right arrow key pressed with change x by 20 below it.
- Confirm the Star has no scripts.
Your Basket is now playable. Next up, you will give the Star its first fall.
Make the Star Fall Once
Your Basket now responds to the keyboard in Scratch. That gives the player control across the bottom of the Stage.
A catching game also needs a moving target. This step gives Star its first falling script. The result reveals whether one fall creates enough action for a game.
In this step, get ready to:
- Place Star at a random horizontal position near the top of the Stage.
- Build the Star's first falling movement.
- Test what happens after the Star passes the bottom of the Stage.
Place the Star at a random starting point
Stage coordinates control where a sprite appears. The x value controls horizontal position. The y value controls vertical position.
A random number gives the Star a different x value each time. This keeps the player from waiting in one fixed spot.
- Select Star in the sprite list.
- Drag when green flag clicked into the empty Code Area.
- Snap a go-to-coordinate block beneath the event.
- Place pick random -210 to 210 in the x input.
- Enter 160 in the y input.
- Click the green flag three times.
Your first piece of Star behavior is working. Each flag click places the Star near the top at a potentially different horizontal position.
Star Not Changing Position?
Make sure Star is selected in the sprite list. Blocks attached to Basket change the wrong sprite.
Check that pick random -210 to 210 fills the x input. Check that 160 fills the y input.
Still stuck? Help me check why my Star does not move to a random starting position.
Build the first fall
A loop repeats the blocks placed inside it. Here, repeat 70 creates 70 small downward movements.
- Snap a control block configured as repeat 70 beneath the position block.
- Place change y by -5 inside repeat 70.
- Click the green flag once.
The Star drops so quickly that its movement may look like a jump. The change proves that all 70 downward movements are running.
- Place wait 0.03 seconds directly below change y by -5 inside the loop.
- Click the green flag again.
You can now follow each downward movement. The Star crosses the Stage in a smooth fall.
Star Not Falling Smoothly?
Make sure change y by -5 sits inside repeat 70. Place wait 0.03 seconds directly below it inside the same loop.
If the Star moves upward, confirm that the movement amount is -5.
Need another pair of eyes? Help me fix my Star's falling movement.
Test the full fall
The completed stack now has a clear starting position followed by its downward movement. Testing without steering keeps your attention on what happens after the Star reaches the bottom.
Before you click the green flag, predict whether the Star will return by itself after it passes the bottom.
- Click the green flag.
- Watch the Stage without pressing either arrow key.
- Keep watching after the Star passes the bottom.
You'll see the Star begin at a random place near the top. It falls past the bottom once.
The Star then stops. This shortfall is intentional because it exposes the missing behavior that prevents the scene from feeling like a complete game.
Why Does the Star Stop?
The green-flag event runs the blocks beneath it from top to bottom. repeat 70 runs its contents exactly 70 times.
After the seventieth wait, the script has no more blocks to run. Scratch leaves this Star script stopped until the green-flag event happens again.
✔️ Awesome, I've got everything!
Great, the project now has one complete falling script for Star. Your existing Basket controls remain unchanged.
ⓧ I'd like to double check the full code
Basket
when green flag clicked
go to x: 0 y: -145
when left arrow key pressed
change x by -20
when right arrow key pressed
change x by 20
Star
when green flag clicked
go to x: (pick random -210 to 210) y: 160
repeat 70
change y by -5
wait 0.03 seconds
How the Scripts Fit Together
The three Basket stacks are unchanged. They reset its position and respond to both arrow keys.
The Star has one stack. Both change y by -5 and wait 0.03 seconds sit inside repeat 70.
No variables exist in the project yet.
Your Star now falls from a random starting point and exposes the game's main limitation. Next, you'll turn this single drop into action that keeps responding to catches and misses.
Bring the Star Back
Your Star can fall from a random top position. However, the one-time script leaves the game frozen after a single drop.
A game loop starts a new fall whenever the previous one ends. This creates the continuous action that a catching game needs.
Collision detection ends the fall when the Star reaches the Basket. A coordinate condition ends it when the Star reaches the bottom.
In this step, get ready to:
- Wrap the current Star script in a forever loop.
- Reset the Star after it falls below -170.
- Reset the Star as soon as it touches the Basket.
Repeat the falling round
Scratch's forever block repeats every block nested inside it. This turns the existing fall into back-to-back rounds.
Snapping a C-shaped block around an existing stack can feel fiddly. The go to x: (pick random -210 to 210) y: 160 block and the repeat 70 block must both sit inside forever.
- Select the Star sprite in the sprite list.
- Find its existing when green flag clicked script in the Code Area.
- Drag forever around the go to x: (pick random -210 to 210) y: 160 block and the complete repeat 70 block.
- Click the green flag.
You'll see the Star fall past the bottom. It immediately returns to a new random horizontal position near the top.
- Click the stop control above the Stage.
Star still falls only once?
Check that forever attaches directly below when green flag clicked. Make sure the complete falling stack sits inside its open section.
Still stuck? Help me check why my Star script does not repeat.
Reset the Star after a miss
The repeat until block keeps its enclosed blocks running while its condition is false. A low vertical position marks the end of a missed catch.
- Drag repeat until inside forever directly below go to x: (pick random -210 to 210) y: 160 so it wraps the existing repeat 70 block.
- Build y position < -170 in the condition slot of repeat until.
Before you test, do you think the Star returns as soon as it passes the bottom of the Stage?
- Click the green flag.
You'll see the Star fall below the Basket. It returns to a new random position near the top after the condition becomes true.
- Click the stop control above the Stage.
How Does the Miss Check Work?
The y position reporter tracks the Star's vertical coordinate. The condition becomes true when that value falls below -170.
The repeat until loop then ends. The surrounding forever loop starts the next fall from the top.
Star stuck near the bottom?
Make sure y position sits on the left side of the less-than comparison. Check that -170 sits on the right side.
Need a hand? Help me fix the miss condition in my Star script.
Reset the Star after a catch
A logical operator lets either stopping condition end the fall. The Star can now respond to a catch or a miss.
- Replace y position < -170 with touching Basket? or y position < -170 in the condition slot.
- Drag the joined change y by -5 and wait 0.03 seconds stack from inside repeat 70 to directly inside repeat until.
Before you try a catch, do you think the Star resets before it reaches the bottom?
- Click the green flag.
- Move the Basket under the falling Star with the left or right arrow key.
You'll see the Star return to the top as soon as it touches the Basket.
- Click the stop control above the Stage.
- Remove the empty repeat 70 block by dragging it back into the blocks palette.
For the final check, predict whether the same loop now handles both possible endings.
- Click the green flag.
- Catch one falling Star with the Basket.
- Let the next falling Star pass the Basket.
You did it. After both outcomes, you'll see the Star reappear at a new random horizontal position near the top.
Catch not resetting the Star?
Check that touching Basket? is one side of the or condition. Make sure y position < -170 is the other side.
Check that change y by -5 and wait 0.03 seconds sit directly inside repeat until.
Still having trouble? Help me debug why the Star does not reset after touching the Basket.
✔️ Awesome, I've got everything!
Great. Your Star now repeats from random positions after catches and misses.
ⓧ I'd like to double check the full scripts
Basket scripts
The Basket has when green flag clicked with go to x: 0 y: -145 beneath it.
The Basket has when left arrow key pressed with change x by -20 beneath it.
The Basket has when right arrow key pressed with change x by 20 beneath it.
Star script
The Star has when green flag clicked with forever beneath it. Inside forever, go to x: (pick random -210 to 210) y: 160 comes first.
The repeat until block follows with touching Basket? or y position < -170 as its condition. Inside it, change y by -5 is followed by wait 0.03 seconds.
No variables exist in the project yet.
Your catching game now keeps responding after every fall. Next, you'll give each successful catch a visible score.
Count Every Catch
Your Star now returns to a fresh position after every catch or miss. The game has a complete action loop.
Each catch still disappears without a trace. A score gives the player lasting feedback. This step records successful catches. A new game clears the total.
In this step, get ready to:
- Create a visible shared score that resets for each game.
- Count each Star catch.
- Verify that a new game clears the score.
Create the score variable
In Scratch, a variable stores a value that can change while the game runs. The visible score monitor lets the player see that value.
- Select the Star sprite in the sprite list.
- Click Variables in the block palette.
- Click Make a Variable.
- Enter score as the variable name.
- Keep the variable available to every sprite.
- Confirm the new variable in the dialog.
Great, your Stage now has a visible score monitor. That monitor gives every catch a visible payoff.
A new game needs a clean starting point. The reset belongs before the repeating game loop so it runs once per green-flag click.
- Place set score to 0 directly between when green flag clicked and forever in the Star script.
Why Reset Before Forever?
The set score to 0 block runs once when the green flag is clicked. Its position outside forever prevents the score from resetting after every fall.
Before you click the green flag, what number should the new game show?
- Click the green flag.
You should see the score monitor show 0.
Score Monitor Missing or Not Resetting?
If the score monitor is hidden, return to Variables. Select the checkbox beside score.
If the score does not return to 0, confirm that set score to 0 sits above forever.
Help me fix my Scratch score reset.
Count a collision
The current loop stops when Star touches Basket or falls below the Stage. Collision detection checks which outcome ended the fall.
A second touch check after the loop separates a catch from a miss. Only a catch increases the score.
- Locate repeat until inside forever in the Star script.
- Add if touching Basket? then directly after repeat until.
- Keep the new conditional block inside forever.
- Place change score by 1 inside the conditional block.
- Click the green flag.
- Catch one falling Star by moving Basket with the arrow keys.
You should see score change from 0 to 1. Star should return to a new position near the top.
- Let the next Star fall past Basket.
You should see score remain at 1. Star should still return to the top after the miss.
Score Increasing After a Miss?
Confirm that touching Basket? fills the condition slot in the new if touching Basket? then block.
Confirm that the conditional block sits after repeat until. Keep both blocks inside forever.
Help me debug my Scratch collision score.
Test the finished score
A final test checks the catch counter. It also proves that the reset still works after adding the conditional block.
Before the final test, what score do you expect after two catches and after a new green-flag click?
- Click the green flag.
- Catch the first falling Star by moving Basket with the arrow keys.
- Catch the second falling Star by moving Basket with the arrow keys.
You should see the score monitor show 2.
- Click the green flag again.
You should see score return to 0 before the next Star begins falling.
A fresh local copy preserves this working version on your Mac. It stays available even if you are not signed into Scratch.
- Open the File menu.
- Choose the local-save option.
- Click Finder in the Dock.
- Select Downloads in the Finder sidebar.
- Confirm that a fresh Catch the Falling Stars.sb3 file is listed.
You did it. Catches now raise a visible score. Starting a new game clears it.
The finished project should match this script map.
✔️ Awesome, I've got everything!
Great. Your game matches the finished script map. Your fresh local copy is safely stored on your Mac.
ⓧ I'd like to double check the full code
Your project is named Catch the Falling Stars. It contains custom-painted Basket and Star sprites.
Basket scripts:
- Basket has when green flag clicked with go to x: 0 y: -145 beneath it.
- Basket has when left arrow key pressed with change x by -20 beneath it.
- Basket has when right arrow key pressed with change x by 20 beneath it.
Star script:
- The script starts with when green flag clicked.
- The set score to 0 block sits directly below the event block.
- The forever loop contains go to x: (pick random -210 to 210) y: 160.
- The repeat until condition is touching Basket? or y position < -170.
- Inside repeat until, change y by -5 runs before wait 0.03 seconds.
- After repeat until, if touching Basket? then contains change score by 1.
Project checks:
- The shared score variable is visible on the Stage.
- Star resets after every catch or miss.
- A catch increases score by 1.
- A green-flag click resets score to 0.
- A fresh local .sb3 copy is saved on the Mac.
Secret mission
Dodge the Asteroid
The Star rewards every catch. Create a distinct faster Asteroid that subtracts two points without resetting the shared score.
Clean Up Your Resources
Clean Up Your Resources
Your locally saved game has no ongoing costs. Decide whether to keep it ready, pause your work, or delete it.
Resources you used:
- One locally saved Scratch project named Catch the Falling Stars.
Keep everything running
No action needed. Choose this if you want to keep developing or playing your game.
- Keep Catch the Falling Stars in a folder you can find again.
- Save an optional backup copy in a second folder.
Pause - I'll come back to this later
Pausing frees the browser memory used by the Scratch editor. When you return, the File menu in Scratch lets you load the same local project.
- Confirm that Catch the Falling Stars appears in the folder where you saved it.
- Switch back to the Scratch editor from earlier.
- Close the browser tab.
Delete - I don't want to use this again
Remove the local project file if you no longer want the game. Moving it to Trash takes it out of the folder where you saved it.
- Find Catch the Falling Stars in the folder where you saved it.
- Drag the local project file to Trash.
- Confirm that Catch the Falling Stars no longer appears in its saved folder.
Nice Work!
Nice Work!
Brilliant work! Your Scratch catching game is now playable from start to finish.
You've learned how to:
- Build a keyboard-controlled catching game. Move the Basket with the arrow keys.
- Expose the one-fall limitation by running the first Star script. Rebuild its motion with a repeating loop. Use conditions to reset each fall after a catch or miss. Use random coordinates to vary each restart.
- Apply collision detection to award points only for catches. Create a visible score variable. Reset score whenever a new game begins.
- Secret Mission: Add a distinct Asteroid as a faster obstacle. Configure each Asteroid catch to subtract two points. Keep the new-game score reset controlled by Star.
Ready to quiz yourself?