In Scratch, clones are exact copies of a sprite that can behave independently. They make it possible to create many similar objects (e.g. Enemies, stars or particles) without creating your own sprites multiple times. Clones save time, simplify code, and make projects more powerful — ideal for games, animations, and interactive simulations that require the same elements in large numbers.
Every time the scratch cat is clicked, a cake appears — as a clone of the cake sprite. Each new cake clone is placed in a random position, so that it is clearly visible that a new cake is created with each click.
Warning about cloning
Attention: Clones can also be created in response to received messages. If clones generate new clones themselves when they receive a message, the number can quickly grow exponentially - each clone generates additional clones, which in turn create more clones. This will quickly reach the maximum number of allowed clones in the project, which can bring the program to a standstill or cause unexpected behavior.
Tips for avoiding:
- Limit the creation of clones to the original sprite (e.g. only when starting the green flag or when clicking on the cat).
- Use conditions (e.g. a variable as a switch) so that only certain sprites respond to the message.
- Implement a counting variable that monitors the current number of clones and stops generating when a limit is reached.
- Avoid incoming messages directly triggering the creation of new clones - instead, let the stage or the original sprite make decisions under control.
With these measures you prevent unwanted exponential cloning and keep your scratch project stable.
Klone gezielt ansprechen – eindeutige ID
Often clones have to be addressed individually afterwards (e.g. Delete, move, change status). To do this, you assign each clone a unique identification number (ID).
- Local variable in the sprite: id
- Global Counting Variable: ID
Process of creating a clone:
- Original Sprite increases the global variable ID by 1.
- It creates a clone.
- In the script "If I arise as a clone", the clone takes the current value of ID into its local variable id.
Advantages:
- Each clone has a stable, unique identifier.
- You can react specifically to certain clones (e.g. "if id = 7, then ...").
- No collisions, as the global ID continuously counts up.

Leave a Reply