4.2.8 "When I start as a clone" block

View

Cloning is a feature that allows a sprite to create a copy of itself while the project is running. Each clone has the same costumes, sounds, scripts, and variables as the original but is otherwise independent. Cloning is commonly used when a project has many similar sprites doing similar things. Because clones are created by the project rather than the user, cloning prevents the user from needing to make the same changes to each of many sprites. There are three blocks related to cloning, all of which are found in the control palette:

The “When I Start as a Clone” block is a control block and a Hat block. Remember that a Hat Block is a block that starts a script when a specific event occurs. All hat blocks are either Control blocks, Events blocks, or More Blocks.

It activates in a clone when it gets created. You use the block to Initialize clones and give them behaviour. 

 

Figure 119: Cloned sprites

 

When space key is pressed, the sprite is going to turn 15 degrees forever and create clone. While holding the space key, you can move each cloned sprite and it will have the same behaviour as the first sprite.

Last modified: Wednesday, 29 September 2021, 5:00 PM