Sprite::clone()
Creates a clone of this sprite, like Scratch's "create clone of myself": a
new sprite of the same class (a clone of a Cat is a Cat),
with the same costume, position, direction, size and pen, and a copy of
the variables of your class. It is put on the stage right behind this
sprite, and its whenStartsAsClone() runs; the constructor does
not run again.
Numbers, text and booleans in your variables are the clone's own. A list or another object is shared with the original: give the clone its own in whenStartsAsClone() if it needs one.
Bullet bullet = (Bullet) this.clone();
Examples
Syntax
Java
.clone()
Scratch
create clone of [myself v]
Return
Sprite