Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Cloning issue
- Takeshi64
-
7 posts
Cloning issue
If I use one of the brown event starting blocks it should only affect the original sprite, right? So why is it creating a clone for all of the clones of that sprite when I didn't use a “when I start as a clone” block?
- Invisible_Factory
-
500+ posts
Cloning issue
Can you leave the link? I don't understand your goal here.
- Takeshi64
-
7 posts
Cloning issue
Can you leave the link? I don't understand your goal here.
https://scratch.mit.edu/projects/93235382/
I'm thinking that the brown blocks are used for actions that affect the original sprite and the “when I start as a clone” block is used to affect clones. So if I clone the original sprite twice I should have 3 sprites there (like 1 x 3). But when I clone it twice I have 8 (2^3) because it seems to clone both the original and all the clones as well. In the project I linked if you click on the sprites they'll move to a random location out of the way so you can see how many there are and you can clone by pressing space. You can clone them by pressing space.
Last edited by Takeshi64 (Jan. 6, 2016 21:51:50)
- qazqweplm
-
19 posts
Cloning issue
I found this wiki about clones : http://wiki.scratch.mit.edu/wiki/Using_Clones_for_Particle_Effects
The second script part may help you(the one about the “is clone?” variable to check whether the receiver is a clone or not)
The second script part may help you(the one about the “is clone?” variable to check whether the receiver is a clone or not)
- Takeshi64
-
7 posts
Cloning issue
http://wiki.scratch.mit.edu/wiki/Using_Clones_for_Particle_EffectsI found this wiki about clones :
The second script part may help you(the one about the “is clone?” variable to check whether the receiver is a clone or not)
That should let me do what I'm trying to, thanks! I still don't really get why the clone system works like this but I guess experimenting may help with that.
- footsocktoe
-
1000+ posts
Cloning issue
If I use one of the brown event starting blocks it should only affect the original sprite, right? So why is it creating a clone for all of the clones of that sprite when I didn't use a “when I start as a clone” block?
That confused me too.
The basic idea is that the clone IS the sprite. Just a duplicate of it. So naturally it responds to all the same things the sprite does.
Fortunately you can use an ID variable to name every clone individually or in groups of clones. And then use IF THEN blocks to control them.
- Phosphor
-
71 posts
Cloning issue
Another method is to use a forever loop underneath a “green flag” block:
A “green flag” script will be copied by clones, just like any other script would. However, since the only way to trigger it involves restarting the project and deleting all existing clones, a clone will never get the chance to run it – only the original sprite will.
A “green flag” script will be copied by clones, just like any other script would. However, since the only way to trigger it involves restarting the project and deleting all existing clones, a clone will never get the chance to run it – only the original sprite will.
- Discussion Forums
- » Help with Scripts
-
» Cloning issue