clone from _clone

Clone Sprites

Cloning is one of the most powerful features of SCL™. When you clone a sprite, the new sprite gets all of its properties and alterations of the original sprite. You can clone either a current sprite or an original sprite as it was originally defined. A clone can be assigned a name using "as cloneName", but this is optional. Immediately after you clone a sprite you can refer to the clone to make updates by using _clone instead of a sprite name, as in "update sprite _clone where x=7".

create sprite as Empty where x=30 and y=30 end create routine as Start clone from Empty using original update sprite _clone where image="ducky.png" update sprite _clone where x=50 and y=80 end

Note that you cannot update an alteration. If you want your clone to have a different alteration, you must remove or insert alterations into your clone as you require.

You can assign a name to a clone using "as": clone from Empty as Ducky using original If you name a clone then you can reference it like any other sprite. You should not assign a name if the same clone statement will be used repeatedly.

Please note the _clone keyword. _clone always refers back to the most recently created clone. The value of _clone can be used until a new clone is created - even in other routines.