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.




💡 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.




✍️ Practise
Make the rain fall at a slant: add change x by -2 inside the loop.
✍️ Practise here in the lesson✖ Close the labor 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🙈 Hide the solution



Medium
Snow: each clone has a random size from 20 to 60 and falls slowly.
👀 Show the solution🙈 Hide the solution



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🙈 Hide the solution




