Discuss Scratch

Skibiji
Scratcher
8 posts

Scratch Clones

I know this is very vague, but I don't understand clones, especially how to figure out which clone is the original and which is not. Also, is it possible to delete a sprite from a game while playing, instead of having to hide it?
NMario84
Scratcher
1000+ posts

Scratch Clones

You can assign each clone their own ID by using a self/sprite only variable. Then check the clone that way.

For example:
when green flag clicked
create clones
define create clones
set [clone id v] to (0) // Check for this sprite only
repeat (5)
change [clone id v] by (1)
create clone of (myself v)
end
set [clone id v] to (0)
when I start as a clone
go to (random position v)

To delete a clone:
delete this clone
Skibiji
Scratcher
8 posts

Scratch Clones

Thanks!
102acrimea
Scratcher
100+ posts

Scratch Clones

Clones at the server side code level are entities that share the same costumes as the original, as well as the state of any variables, position and visibility upon being created. Clones can run different scripts from the original using the “when I start as a clone” block and can further diverge from other clones using variables “for this sprite only”. Clones and the original all run event blocks such as “when key space is clicked”, “when this sprite is clicked”, “when I recive message1” (this is important as it causes projects to bug out often) and other scripts. The difference between clones and the original is the fact that clones do not run the “when green flag is clicked” block as they get deleted upon the project stopping. Clones also can delete themselves, terminating all their scripts. Clones are also seperate entities from the original so blocks such as “stop all scripts on this sprite” will only affect the clone/original running it.

tldr; Clones are the exact same as the original, but are seperate entities that can be deleted and run “when I start as a clone”, as well as having their own variables and lists that are marked “for this sprite only”.

No you cannot delete a sprite while the game is running, but you can do this which is as good as deleting it (till the flag is clicked)

hide
stop [other scripts in this sprite v]

Powered by DjangoBB