When I Start as a Clone | |
when I start as a clone | |
Category | Control |
Type | Hat |
Introduced in | 2.0 |
The When I Start as a Clone block is a control block and a Hat block. It was originally called Clone Startup before Scratch 2.0 v230[1] but was likely renamed to clear up confusion on what the block did. Scripts attached to this block are activated by clones when the clones are created.
Since Scratch 2.0, "When I start as a clone" has been the only Hat block in the Control palette category; all the others are in Events, in My Blocks, or in Extensions.
clone startup:: hat control
Activation
Whenever a clone is created, it will run all of these blocks in its sprite.
Note: | You can use more than one of these to simplify big scripts. |
Example Uses
Clones are often meant to do an action when created, rather than waiting for a different event. They allow for multiple copies of a sprite without having to duplicate it and all its properties. When I Start as a Clone is the hat block of the scripts that will perform in the clone once it is created. There can be multiple of this block in the same sprite; the clone will just run all of the scripts simultaneously. The script itself can be running on multiple clones at once. Some of such actions that this block can perform include:
- Position a clone randomly
when I start as a clone go to (random position v)
In reading this, when the clone is created, it will set its x and y position to a random location on the stage.
- Make a clone travel until colliding with another sprite
when I start as a clone repeat until <touching (sprite 2 v)?> move (3) steps
In reading this, the clone will travel until It hits the specified sprite, in this case "sprite 2". This is useful in games where objects must be launched in attempt to collide with another sprite.