انتقل للمحتوى
Robo EgyptRobo Egypt
☰ Course contents
Robo Block: home
0. Lab tour1
1. Getting started5
2. Motion5
3. Looks and sound5
4. Events4
5. Loops5
6. Conditions and sensing4
7. Variables and randomness4
8. Project: the “Catch Robo” game3
9. Messages: characters talk to each other4
10. Clones: one character, many copies4
11. My Blocks: make a new block3
12. Operators and time4
13. The pro project: a jumping game4

Clones that move: rain

Section 10: Clones: one character, many copiesLesson 10.2 · ⏱ 8 min

The original hides and makes the clones, and each clone starts in a random place at the top, falls until it reaches the bottom of the stage, then delete this clone removes it. Without deleting, the memory fills up.

🧩 The original
Blocks: when 🚩 clicked, hide, set size to (40) %, repeat (10)
🧩 Every clone
Blocks: when I start as a clone, go to x: (pick random -200 to 200) y: (170), show, repeat until <(y position < -140)>, delete this clone
Clones falling from different places
Clones falling from different places
New clones falling, and the old ones gone at the ground
New clones falling, and the old ones gone at the ground
💡 Tip
pick random -200 to 200 gives every clone a different x, so the rain looks natural.

📌 Another example: rising bubbles

Like the rain but going up: every clone starts at the bottom of the stage and rises until y is more than 140 (the edge of the stage is 145), then deletes itself.

Blocks: when 🚩 clicked, hide, set size to (35) %, repeat (8)
Blocks: when I start as a clone, go to x: (pick random -200 to 200) y: (-170), show, repeat until <(y position > 140)>, delete this clone
The first bubbles
The first bubbles
Lots of bubbles
Lots of bubbles
✍️ Practise
Make the rain fall at a slant: add change x by -2 inside the loop.
✍️ Practise here in the lessonor open the lab in a new page ↗

🎯 Challenge yourself

Easy

Make the raindrops fall at different speeds: change y by (pick random -9 to -3).

👀 Show the solution
Blocks: when 🚩 clicked, hide, set size to (40) %, repeat (10)
Blocks: when I start as a clone, go to x: (pick random -200 to 200) y: (170), show, repeat until <(y position < -140)>, delete this clone
The result on the stage
The result on the stage
Medium

Snow: each clone has a random size from 20 to 60 and falls slowly.

👀 Show the solution
Blocks: when 🚩 clicked, hide, repeat (10)
Blocks: when I start as a clone, set size to (pick random 20 to 60) %, go to x: (pick random -200 to 200) y: (170), show, repeat until <(y position < -140)>, delete this clone
The result on the stage
The result on the stage
Hard

Rain that never ends: the original makes a clone every 0.2 seconds inside forever, and each clone is deleted when it reaches the bottom.

👀 Show the solution
Blocks: when 🚩 clicked, hide, set size to (30) %, forever
Blocks: when I start as a clone, go to x: (pick random -200 to 200) y: (170), show, repeat until <(y position < -140)>, delete this clone
Endless rain
Endless rain
Finished the lesson? Mark it so your progress counts.