Hey there, young coder! Have you ever played a game where you move a basket to catch falling fruit? Today, we're going to build our own version in Scratch 3.0! It’s super fun, and I’ll guide you step-by-step.
Think of coding like building a house. We start with the foundation (our game setup), then build walls (adding characters and movements), and finally decorate it with cool features (extra effects and challenges).
Step 1: Setting Up the Game
What do we need?
A falling fruit (Apple)
A basket to catch it
A stage (background) to play on
Adding Sprites
1. Open Scratch 3.0.
2. Delete the default cat sprite by clicking the trash can.
3. Click Choose a Sprite and select:
Apple (for the falling fruit)
Bowl (for the basket)
🎨 Tip: You can also draw your own fruit and basket in the Costume Editor.
Step 2: Moving the bowl Left and Right
Imagine the basket is your hands, and you need to move it left and right to catch the falling apple.
Code for the Bowl
1. Click on the Bowl sprite.
2. Go to the Code tab and drag these blocks:
Code Snippets
when [left arrow] key pressed
change x by (-10)
when [right arrow] key pressed
change x by (10)
📌 What this does:
When you press the left arrow key, the basket moves left (-10 pixels).
When you press the right arrow key, the basket moves right (+10 pixels).
🛠 Think of it like steering a car – left and right!
Step 3: Making the Apple Fall from the Sky
Now, we need to make the apple drop from the top just like real fruit falling from a tree.
Code for the Apple
1. Click on the Apple sprite.
2. Drag and drop these blocks:
Code snippets
when green flag clicked
set y to 170
go to random position
forever
change y by -10
if (y position < -170) then
go to random position
set y to 170
🍏 What this does:
The apple starts at the top (y = 170).
It falls downward (change y by -10).
When it reaches the bottom (y < -170), it goes back to the top at a random position.
🌧 Think of this like rain – the apple keeps falling and resets at the top.
Step 4: Catching the Apple and Scoring Points
Now let’s check if the basket catches the apple and increase the score.
Create a Score Variable
1. Go to Variables.
2. Click Make a Variable → Name it Score.
3. Drag these blocks into the Apple sprite:
Code snippets
if <touching [Bowl]> then
change [Score] by 1
go to random position
set y to 170
🏆 What this does:
If the apple touches the basket, you earn 1 point.
The apple restarts at the top.
🎯 Think of this like a basketball game – every time you catch the fruit, you score a point!
Step 5: Adding More Fun! 🎉
Want to make your game even more exciting? Try these challenges:
1. Add More Fruits 🍌🍇 – Use different sprites like bananas or grapes and make them fall at different speeds.
2. Add Sounds 🎵 – Play a “ding” sound when you catch a fruit.
3. Set a Timer ⏳ – Make the game last 30 seconds and see how many fruits you can catch!
Try It Out! 🚀
Now it’s your turn! Follow these steps and create your own Catch the Fruit game.
👉 What other fun features can you add? Comment below and share your ideas!
I hope you had fun coding today. Remember, coding is like magic – you can create anything you imagine! ✨
Happy coding! 🚀
Comments
Post a Comment
Thank you