(Not such great example uses... anyone care to expand?)
 
(Image with ScratchBocks replacing.)
(26 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{Block
+
{{block
|name      = Clone Startup
+
|name      = When I Start as a Clone
|image      = File:Clone startup 2011 pre-alpha.png
+
|image      = when I start as a clone
|imagewidth = 91px
 
 
|category  = [[Control Blocks|Control]]
 
|category  = [[Control Blocks|Control]]
 
|type      = [[Hat Block|Hat]]
 
|type      = [[Hat Block|Hat]]
 
|added      = 2.0
 
|added      = 2.0
 +
|sb        = yes
 
}}
 
}}
The '''Clone Startup''' [[Blocks|block]] is a [[Control Blocks|control block]] and a [[Hat Block|Hat block]]. It activates in a [[clone]] when it gets created.
+
The '''When I Start as a Clone''' [[Blocks|block]] is a [[Control Blocks|control block]] and a [[Hat Block|Hat block]]. It was originally called Clone Startup, but was likely renamed to clear up confusion on what the block did. It activates in a [[clone]] when it gets created.
  
In [[Scratch 2.0]], this is the only Hat block in the Control Palette; all the others are in [[Event Blocks|Events]].
+
In [[Scratch 2.0]], this is the only Hat block in the Control palette; all the others are in [[Event Blocks|Events]], [[Motor Blocks|Motor]], or [[PicoBoard Blocks|PicoBoard]].
 +
{{Block Frame|blocks=<sb>clone startup :: hat control</sb>|caption=The original name of the block.}}
  
 
==Example Uses==
 
==Example Uses==
{{expand}}
+
[[Clone]]s are often meant to do an action when created, rather than waiting for a different [[Event Based Programming|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:
Clones are often meant to do an action when created, rather than waiting for a different [[Event Based Programming|event]].
+
* Position a clone randomly
*Position a clone randomly
 
 
<scratchblocks>
 
<scratchblocks>
clone startup
+
when I start as a clone
 
go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))
 
go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))
 
</scratchblocks>
 
</scratchblocks>
 +
In reading this, when the clone is created, it will set its x and y position to any location on the stage.
 +
* Make a clone travel until colliding with another sprite
 +
<scratchblocks>
 +
when I start as a clone
 +
repeat until <touching [sprite 2 v]?>
 +
move (3) steps
 +
</scratchblocks>
 +
In reading this, the clone will travel until It hits the specified sprite, in this case "sprite 2". This is useful in game where objects must be launched in attempt to collide with another sprite.
  
 
==See Also==
 
==See Also==
*[[Create Clone of () (block)|Create Clone of ()]]
+
* [[Create Clone of () (block)|Create Clone of ()]]
*[[Delete This Clone (block)|Delete This Clone]]
+
* [[Delete This Clone (block)|Delete This Clone]]
*[[Cloning]]
+
* [[Cloning]]
 +
* [[Using Clones for Particle Effects]]
 +
* [[Advanced Clone Usage]]
 +
 
 
{{Control Blocks}}
 
{{Control Blocks}}
[[Category:Control Blocks]] [[Category:Scratch 2.0]]
+
 
 +
[[Category:Control Blocks]] [[Category:Scratch 2.0]] [[Category:Cloning]]
 +
[[de:Wenn ich als Klon entstehe (Block)]]
 +
[[ja:クローンされたとき (ブロック)]]

Revision as of 15:05, 18 September 2019

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, but was likely renamed to clear up confusion on what the block did. It activates in a clone when it gets created.

In Scratch 2.0, this is the only Hat block in the Control palette; all the others are in Events, Motor, or PicoBoard.

clone startup :: hat control
The original name of the block.

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 x: (pick random (-240) to (240)) y: (pick random (-180) to (180))

In reading this, when the clone is created, it will set its x and y position to any 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 game where objects must be launched in attempt to collide with another sprite.

See Also