🍎How to make a "Apple and Basket" game

 


🧰 What You’ll Need:


🔨 Step 1: Create a New Project

  1. Go to scratch.mit.edu and log in.

  2. Click "Create" to start a new project.

  3. Delete the default cat sprite by right-clicking it and choosing delete.


🍎 Step 2: Add Sprites

  1. Click the “Choose a Sprite” button.

  2. Search for and add:

    • A basket sprite (or choose something like "bowl").

    • An apple sprite.


🎨 Step 3: Set the Stage

  1. Click on “Choose a Backdrop” and select a background (like "Blue Sky").

  2. Optionally, you can draw your own!


🧠 Step 4: Code the Basket (Player)

Make it move left and right:

  1. Click the basket sprite.

  2. Add this code:


when green flag clicked go to x: 0 y: -140 forever if <key (right arrow) pressed> then change x by 10 end if <key (left arrow) pressed> then change x by -10 end end

🍏 Step 5: Code the Apple (Falling Object)

  1. Click the apple sprite.

  2. Add this code:


when green flag clicked go to x: pick random -200 to 200 y: 180 show forever change y by -5 if <touching (Basket)> then go to x: pick random -200 to 200 y: 180 end if <y position < -160> then go to x: pick random -200 to 200 y: 180 change [Lives v] by -1 end end

❤️ Step 6: Add a Lives Variable

  1. Click "Variables" → "Make a Variable" → name it Lives.

  2. Set it to 3 at the start:


when green flag clicked set [Lives v] to 3
  1. Add a "Game Over" message:


if <(Lives) = 0> then say [Game Over!] for 2 seconds stop [all v] end

⭐ Step 7: Add Score (Optional)

  1. Make another variable called Score.

  2. Inside the apple's code, when it touches the basket:


change [Score v] by 1

✅ You’re Done!

Now click the green flag and play your game:

  • Move the basket with arrow keys.

  • Catch the falling apples.

  • Miss three apples, and it’s game over.

Comments

Popular posts from this blog

🚶‍♂️ How to Make a Walking Animation in Scratch

🎮 How to Make a "Chase Game" in Scratch