Catch the Falling Apples
π― Apples fall from the top; move the basket with the arrow keys to catch them. Each catch scores a point.
π‘ The idea behind it
A game is a loop that checks for things happening β and a variable that remembers what happened.
π§± Blocks you will need
foreverif touching?go to x: y:pick randomset score to 0change score by 1key pressed?
π¨ Build it
- Make a variable called score. Set it to 0 when the flag is clicked β this matters more than it looks.
- The basket: forever β if key right arrow pressed, change x by 10; if left arrow pressed, change x by β10.
- The apple: go to x (pick random β220 to 220) y 180, then forever β change y by β5.
- Inside that loop: if touching basket β change score by 1 β go back to the top at a new random x.
- Also: if y position < β170, go back to the top without scoring β a missed apple.
π Make it harder
- Add a lives variable that goes down when an apple is missed, and stop the game at zero.
- Make the apples speed up as the score rises.
π Bugs you will hit
- The score keeps growing from the last game: you forgot 'set score to 0' at the start.
- One apple scores many points: it must move away immediately after touching, in the same if block.
- The basket moves in jerks: use 'change x by' inside a forever loop rather than the 'when key pressed' event.
β¬ Need Scratch itself?
Free from MIT, in a browser or as an offline app that needs no connection at all.