From Test-Scratch-Wiki
Create Clone of () | |
![]() | |
Category | Control |
Type | Stack |
Introduced in | 2.0 |
The Create Clone of () block is a control block and a stack block. It creates a clone of the sprite in the argument. It can also clone the sprite it is running in, creating clones of clones, recursively.
History
In the Scratch Day 2011 pre-alpha, this block was called Create Clone, with no argument. As such, it could only create a clone of the sprite it ran in; not others. The advantage of an argument is that a single sprite, or the Stage, can clone several different sprites upon an event.
Example Uses
Cloning is often used when a sprite must make copies of itself. Below are some examples:
- Unlimited bullets in a shooting game
when [space v] key pressed create clone of [bullet v]
when I start as a clone go to [player v] point towards [mouse-pointer v] repeat until < <touching [edge v]?> or <touching [target v]?> > move (3) steps end delete this clone
- Creating several copies of a sprite to click
when gf clicked set [sprites to find v] to [10] repeat (sprites to find) create clone of [Sprite1 v] end
when I start as a clone wait until <<mouse down?> and <touching [mouse-pointer v]?>> say [You got me!] for (2) secs hide change [sprites to find v] by (-1)