Introduction – Fruit Catching Game in Scratch
Welcome to a super fun and educational Scratch game tutorial! Today, you’ll create your very own Catch the Falling Fruit Game in Scratch — a colorful, exciting, and easy-to-make project perfect for beginners, students, and kids learning to code.
The goal? Catch falling fruits in your basket and try not to lose your lives. Ready to dive in?
Watch this tutorial on Kodex Academy YouTube Channel – Catch the Falling Fruit Game in Scratch | Easy Scratch Game Tutorial by Kodex Academy
Why This Game Rocks for Young Coders
This game is a shining example of how kids or beginners can learn core programming concepts in a playful environment. You’ll:
- Understand how Scratch projects are structured
- Learn how to use sprites and backdrops
- Add multiple costumes to a sprite for variety
- Create and use variables (
score
andlife
) - Use conditions, and random positioning – Win when score hits a target; Game Over when lives run out
- Event-Driven Programming:
When green flag clicked
,If touching
,Broadcast
,When I receive
, and more - Loops: Forever loops for continuous gameplay
- Randomness & Positioning: Random starting X positions for fruits
- User Controls: Control a basket sprite with arrow keys
- Make sprites move and detect collisions
- Trigger “You Win” and “Game Over” events with broadcast messages
- Sound Integration & Visual Feedback – Add background music and sound effects
- Display score and life values on screen
- Enhance the game with difficulty levels, special fruits, and timers
Step-by-Step Coding Guide using Scratch Block Programming
1. Game Overview
In Catch the Falling Fruit, fruits fall from the top of the screen at random positions. Your goal is to catch them in a basket to score points. If you miss a fruit, you lose one life. The game ends when:
- You win: Your score reaches the target (default: 10 points)
- You lose: Your life reaches 0
2. Setting Up Your Project
2.1. Choosing Sprites and Backdrop
- Delete the default Scratch cat sprite.
- Choose sprites:
- Fruit sprite (with multiple costumes: apple, banana, orange)
- Basket or ball sprite (player-controlled by arrow keys)
- Red line (to detect missed fruit)
- Text sprites for “You Win” and “Game Over”
- Choose a colorful, bright backdrop like “Blue Sky” from the Scratch library.
This foundation ensures your Scratch fruit game tutorial looks polished and is easy to follow.
2.2. Adding Multiple Costumes
Go to the Costumes tab of your Fruit sprite and:
- Keep the default apple
- Add Banana and Orange from the “Food” category
- You now have three costumes for variety
- Use “Next Costume” to cycle, ensuring visual variety
2.3. Creating Win and Game Over Screens
Use the Paint option to create text-based sprites:
- You Win: Blue font, large size
- Game Over: Red font, large size
These will remain hidden until triggered.
3. Variables: Score & Life
Create two variables:
Go to Variables > Make a Variable for each one.
- Score → Tracks points earned. Increments with each fruit caught in the basket
- Life → Tracks remaining lives. Decrements when fruits hit the line
score = 0
life = 3
These are core to “Add lives in Scratch game” and tracking player progress.
4. Coding the Fruit Sprite
when green flag clicked
set score to 0
set life to 3
go to x: (pick random -180 to 180) y: 180
forever
change y by -5
if <y position < -170> then
change life by -1
go to x: (pick random -180 to 180) y: 180
next costume
end
if <touching [basket v]?> then
play sound [chomp v]
change score by 1
go to x: (pick random -180 to 180) y: 180
next costume
end
end
Explanation:
- Initial Position: Fruit starts at the top with a random X position.
- Movement: Constant downward motion.
- Miss Detection: If Y < -170, you lose a life.
- Catch Detection: If touching the basket, score increases and sound plays.
- Costume Change: Switches between apple, banana, and orange for visual variety.
5. Win and Game Over Conditions
5.1. Win Condition:
when green flag clicked
hide [You Win v]
forever
if <score >= 10> then
broadcast [You Win v]
end
end
when I receive [You Win v]
hide [Fruit v]
stop other scripts in sprite
show [You Win v]
5.2. Game Over Condition:
when green flag clicked
hide [Game Over v]
forever
if <life = 0> then
broadcast [Game Over v]
end
end
when I receive [Game Over v]
stop all
show [Game Over v]
Explanation:
- Broadcast Messages allow different sprites to respond to win/loss events.
- “You Win” stops the fruit from falling and shows the win message.
- “Game Over” stops all scripts and shows the loss message.
6. Basket Movement Controls
when green flag clicked
go to x: 0 y: -140
forever
if <key [right arrow] pressed?> then change x by 10
if <key [left arrow] pressed?> then change x by -10
end
Explanation:
- Fixed Y Position: Basket only moves horizontally.
- Arrow Key Detection: Moves left/right by changing the X coordinate.
7. Displaying Life on Screen
Code (on Red Line Sprite):
when green flag clicked
go to x: 0 y: -160
forever
say (join [Life: ] (life))
en
d
Explanation:
- Keeps the life counter visible throughout the game.
8. Sound and Visual Enhancements
when green flag clicked
forever
play sound [drip-drop v] until done
end
Explanation:
- Looping background sound adds immersion.
Full Code Snippets (for clarity)
// Fruit Sprite
when green flag clicked
set score to 0
go to x: (random -180 to 180) y: 180
forever
change y by -5
if y < -170 then
change life by -1
go to random x, y: 180
next costume
end
if touching basket? then
play sound [chomp v]
change score by 1
go to random x, y: 180
next costume
end
end
when I receive You Win
hide
stop other scripts in sprite
when I receive Game Over
hide
stop all
// Game Controller
when green flag clicked
set life to 3
hide [You Win v]
hide [Game Over v]
repeat forever
if score ≥ 10 then broadcast You Win
if life = 0 then broadcast Game Over
end
// Basket
when green flag clicked
go to x: 0 y: -140
forever
if key [right arrow] pressed? then change x by 10
if key [left arrow] pressed? then change x by -10
end
// Background Sound
when green flag clicked
forever
play sound [drip-drop v] until done
end
9. Enhancement Features & Customization
9.1 Increasing Difficulty Over Time
Increase falling speed gradually: change y by -speed
, then slowly increase speed
.
when green flag clicked
set [speed v] to 5
forever
wait 5 seconds
change [speed v] by 1
end
Replace change y by -5
with change y by (-speed)
.
9.4 Combo Score Bonus
if score mod 5 = 0 then
change score by 2 // bonus
end
9.3 Adding Power-Ups or Special Fruits
Add rare fruits that give extra points or slow down drop speed.
- Duplicate fruit sprite, make it golden.
- Catching it gives +5 score.
if <touching [basket v]?> then
change score by 5
9.3 Visual Animations
Animate “You Win” or “Game Over” sprites with spinning or scaling effects.
repeat 10
change size by 10
wait 0.1 secs
change size by -10
end
9.4 Timer Mode – Adding a Countdown Timer
when green flag clicked
set [timer v] to 60
forever
wait 1 second
change [timer v] by -1
if <timer = 0> then
broadcast [Game Over v]
end
end
9.5 High Score Tracking
Use cloud variables
(if available) or local storage to display and track high scores.
9.6 Responsive Design
Resize sprites dynamically based on device screen or window size for mobile compatibility.
10. Testing and Full Gameplay Flow
Once everything is coded:
- Test the game thoroughly:
- Does the basket move smoothly?
- Are collisions and scoring accurate?
- Do win/loss conditions trigger correctly?
- Make adjustments to speeds, sprite sizes, sound volume, or messages as needed.
- Click green flag → Score = 0, Life = 3, Fruit drops.
- Catch fruit → Score +1, change costume.
- Miss fruit → Life -1.
- Win at Score ≥ 10 → Show “You Win”, stop fruit.
- Lose at Life = 0 → Show “Game Over”, stop all scripts.
11. Conclusion
You’ve just built a complete fruit catcher game in Scratch using:
- Variables for score and lives
- Conditional win/loss events
- Broadcast messaging for sprite coordination
- Sound effects and costume animations
- Keyboard controls
This is an excellent Scratch project for students to learn loops, events, conditions, and variables — and you can customize it endlessly!
Call to Action
- Don’t forget to check out the full video tutorial by Kodex Academy here: Catch the Falling Fruit Game in Scratch | Easy Scratch Game Tutorial by Kodex AcademyAcademy
- Like, comment & share the video
- Visit kodexacademy.com
- subscribe to the Kodex Academy YouTube channel for deeper Scratch content.
Happy coding with Kodex Academy! 🚀
Learn More with Kodex Academy
At Kodex Academy, we’re passionate about helping students learn coding in creative ways. This project teaches more than Scratch—it empowers young minds to build tools that work in the real world.
Explore more:
Stay updated with new content, free tutorials, and coding challenges!
- 🌐 Website: https://kodexacademy.com
- 🌐 Website: https://games.kodexacademy.com
- 💬 WhatsApp Channel: Join Now
- 💼 LinkedIn: Kodex Academy
- 📸 Instagram: @kodex_academy
- 𝕏 Twitter: @Kodex_Academy
- 📢 Telegram: Join Our Channel
- 🔗 Patreon: patreon.com/KodexAcademy
Further Reading & Links
- Scratch Wiki Motion Blocks: https://en.scratch-wiki.info/wiki/Motion_Blocks
- Scratch Programming for Beginners: https://scratch.mit.edu/projects/editor
- Scratch Animation Guide: https://en.scratch-wiki.info/wiki/Animating