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.