Week 5 of 6 ยท Lesson for Students

Lists, Cloning & Advanced Logic

Today you will build a falling-objects catcher game using clones โ€” copies of a sprite created while the game runs โ€” and store your high scores in a list.

1
2
3
โœ“
4
5
โœ“
6
7
๐Ÿ†
1
Set up the catcher game
Start a new project with a catcher sprite at the bottom of the stage
  1. Start a new Scratch project (File โ†’ New) โ€” this week we build something fresh.
  2. Delete the default cat sprite (right-click it โ†’ Delete).
  3. Add a sprite to be the catcher (a bowl, a basket, or a wide flat shape). You can also paint a rectangle.
  4. Place it near the bottom of the stage.
  5. Add arrow-key scripts (from Week 2) to move it left and right only (change x by ยฑ20). No up/down needed.
  6. Create the score variable (Variables โ†’ Make a Variable โ†’ "score", For all sprites) and initialise it in a flag-clicked script.
โš ๏ธ Watch out!
  • The catcher should only move left and right (change x). Do not add up/down controls.
  • Make the catcher sprite fairly wide so it is possible to catch things โ€” a narrow catcher makes the game too hard for testing.
2
Add the falling object sprite and hide it
The original sprite acts as a factory โ€” invisible, but it creates clones
  1. Add a new sprite as the falling object โ€” a fruit, a ball, a star. Make it small (size 40โ€“60).
  2. Click on this falling object sprite to select it.
  3. Add a script: when ๐Ÿšฉ clicked โ†’ hide.
  4. Click the green flag. The sprite should vanish from the stage.
๐Ÿ‘€ What you should see

The falling object sprite disappears when the flag is clicked. Only the catcher remains visible. This is intentional โ€” the original sprite is now an invisible spawner that creates clones.

โš ๏ธ Watch out!
  • The hide block hides the original sprite. Clones will each have their own show block added in the next step โ€” they will be visible.
  • If the sprite is still visible after clicking the flag, check the hide block is connected directly below the flag hat block โ€” not floating alone.
  • Do not hide the catcher sprite โ€” only the falling object spawner.
3
Create clones on a timer
A forever loop spawns a new clone every second
  1. Still on the falling object sprite, extend the flag-clicked script:
  2. Below the hide block, add a forever loop.
  3. Inside the forever loop, add create clone of [myself] from the Control section.
  4. Below that (still inside the forever), add wait 1 second.
  5. Click the green flag. Nothing visible should happen yet โ€” but clones are being created every second (they are hidden).
โš ๏ธ Watch out!
  • Do not remove the wait block. Without it, the forever loop runs thousands of times per second and Scratch will create so many clones the project freezes. Always wait between spawns.
  • If the project freezes or runs very slowly, press the red stop button, then click the green flag again. Check the wait block is inside the forever loop.
  • The create clone of [myself] block creates a copy of the current sprite. "Myself" is correct.
๐Ÿ” Check Your Progress โ€” After Step 3

Your falling object sprite's flag-clicked script should be:

when ๐Ÿšฉ clicked
  hide
  forever
    create clone of [myself]
    wait 1 second
  end

  • The original sprite is hidden when the flag starts
  • The forever loop and wait block are both present
  • No visible clones yet (they will appear after Step 4)
๐Ÿ†˜ Something looks wrong?
  • Project is freezing or very slow: The wait block is missing or outside the forever loop. Right-click on the Scripts Area โ†’ "Stop all" then fix the script.
  • I can't find "create clone of": It's in the yellow-orange Control section. Scroll down past the if/else and loop blocks.
  • The sprite is still visible: Check the hide block is snapped directly under the flag, before the forever loop.
4
Make each clone fall from a random position
The "when I start as a clone" block runs for each new clone
  1. Still on the falling object sprite, add a completely new separate script (don't connect to the existing one).
  2. Drag when I start as a clone from the Control section to an empty area of the Scripts Area.
  3. Below it, add show โ€” each clone needs to make itself visible.
  4. Add go to x: (pick random -200 to 200) y: 180 โ€” this places each clone at the top of the stage at a random x position.
  5. Now add a repeat until loop. In its condition put: (y position) < -175.
  6. Inside the loop: change y by -5 โ€” this makes the clone fall down.
  7. After the loop (below it, outside): delete this clone.
  8. Click the green flag. Objects should now fall from the top!
๐Ÿ‘€ What you should see

Every second, a new copy of your sprite appears at the top of the stage at a random x position and falls downward. When it reaches the bottom it disappears.

โš ๏ธ Watch out!
  • The when I start as a clone script is separate from the flag-clicked script โ€” they are two independent scripts on the same sprite.
  • The delete this clone must be outside and below the repeat-until loop, so it only runs after the clone has finished falling โ€” not every frame.
  • If the objects fly upward instead of falling, change change y by -5 to a negative number. A negative y = downward.
  • If nothing appears, the show block might be missing at the top of the clone script.
5
Detect when the catcher catches an object
Score a point and delete the clone when it touches the catcher
  1. Inside the repeat until loop (where the clone falls), add an if block.
  2. In its condition: touching [Catcher sprite]? (choose your catcher's name from the dropdown).
  3. Inside the if: change [score] by 1 then delete this clone.
  4. Test: move the catcher to catch falling objects. Score should go up by 1 each catch!
๐Ÿ‘€ What you should see

When a falling object touches the catcher, it disappears and the score increases. Objects that are not caught fall off the bottom and also disappear (from the repeat-until loop).

โš ๏ธ Watch out!
  • The if block must be inside the repeat-until loop โ€” inside the C-shape. Otherwise, catching is only checked once at the start.
  • After change [score] by 1, you must add delete this clone immediately โ€” otherwise the clone keeps falling and triggers the score many times while overlapping.
  • If the catcher sprite name doesn't appear in the dropdown, the catcher may have been accidentally named something unexpected. Check the Sprite Pane for its exact name.
๐Ÿ” Check Your Progress โ€” After Step 5
  • Objects fall from the top of the stage at random x positions
  • Catching an object increases the score by 1
  • Missed objects disappear at the bottom
  • Score resets to 0 on green flag
๐Ÿ†˜ Something looks wrong?
  • Score goes up multiple times per catch: Add delete this clone immediately after change score by 1 inside the if block.
  • Objects pile up and don't disappear: The delete this clone at the end (after the loop) may be missing. It must be outside the loop but inside the "when I start as a clone" script.
  • Everything runs but no clones appear: The show block might be missing from the clone script. Add it as the very first block after "when I start as a clone".
6
Create a "High Scores" list
A list stores multiple values โ€” like a column in a spreadsheet
  1. In the Variables section, click "Make a List" (below "Make a Variable").
  2. Name it High Scores โ€” make sure "For all sprites" is selected. Click OK.
  3. A list display appears on the stage, and new list blocks appear in the palette.
  4. In your flag-clicked script, add delete all of [High Scores] to clear old scores each run.
๐Ÿ‘€ What you should see

An empty list box appears on the stage next to the score display. The palette now has orange-red list blocks: "add to", "delete", "item of", "length of".

โš ๏ธ Watch out!
  • If you do not add "delete all" on green flag, scores will keep accumulating across multiple runs and the list will grow very long.
  • A list is different from a variable โ€” a variable holds one value, a list holds many. Use a list when you want to remember multiple things (multiple scores, multiple names).
7
Save the score to the list on game over
Each time the game ends, the final score is added to the list
  1. Add a game-over timer: in your flag-clicked script, after initialising variables, add a wait 30 seconds then broadcast [game-over]. (This gives 30 seconds of play.)
  2. Add a new script: when I receive [game-over] โ†’ stop [other scripts in sprite] โ†’ add (score) to [High Scores].
  3. Drag the score variable oval (orange circle from Variables) into the "add" block's slot.
  4. After the list add: say (join [Game Over! Score: ] (score)) for 3 seconds.
  5. Play the game twice. The High Scores list on the stage should show both scores!
โš ๏ธ Watch out!
  • Use stop [other scripts in sprite] โ€” NOT "stop all". "Stop all" would stop the game-over script itself before it saves the score.
  • Drag the score oval into the add-to-list block โ€” do not type the word "score". You need the live value, not the word.
  • The join block is in the green Operators section. Drag it into the "say for 2 seconds" slot. Put your label text in the left part and the score oval in the right part.
๐Ÿ“‹

Amazing โ€” Week 5 complete!

You have built a full catcher game with clones, and saved scores to a list. Next week โ€” the final lesson โ€” you will add proper game screens and a persisting cloud high score.