Discuss Scratch

BigBadCheeseMan
Scratcher
8 posts

Too many clones being created

Okay, it's probably a very simple fix, but in my project here, I have a set of scripts where one sprite will broadcast a message to create a clone, and then another sprite will be cloned. This works fine for about five seconds, then it starts to create clones way too quickly. am I overlooking something? help would be great!


EDIT: I just thought of switching the broadcast block for a cloning block, but it still make too many clones. While I'm at it, can anyone help me with giving the different clones different amounts of “health?” as well as creating a smooth, semi-random movement piece? that would be great!
crisostimo
Scratcher
500+ posts

Too many clones being created

I have a well commented tutorial on cloning that may help you:

https://scratch.mit.edu/projects/94046493/
Brontosplachna
Scratcher
100+ posts

Too many clones being created

The project is not shared, but I will remind you that clones receive and act on messages just like the original sprite does. So a script like
whenIreceivemessagecreatecloneofmyself

will create one new clone for each clone that receives the message.



asivi
Scratcher
1000+ posts

Too many clones being created

Brontosplachna wrote:

The project is not shared, but I will remind you that clones receive and act on messages just like the original sprite does. So a script like
whenIreceivemessagecreatecloneofmyself

will create one new clone for each clone that receives the message.



That is the reason why the parent and its clone are needing a variable for that sprite only and to give different values for both.
whenclickedhidesetIdentifiertoparent
whenIreceiveifIdentifier=parentthensetIdentifiertochildcreatecloneofmyselfsetIdentifiertoparent
whenIstartasacloneshow. . .

Last edited by asivi (June 3, 2016 18:23:37)

BigBadCheeseMan
Scratcher
8 posts

Too many clones being created

Sorry about not sharing it, but I think I get it now. Thanks for clearing it up!
asivi
Scratcher
1000+ posts

Too many clones being created

BigBadCheeseMan wrote:

Sorry about not sharing it, but I think I get it now. Thanks for clearing it up!
Your'e welcome. Have fun!
Marreepsie
Scratcher
1 post

Too many clones being created

Replace the broadcast “***” with create clone of *the sprite who receives the messages. Worked for me.
cs4117933
Scratcher
7 posts

Too many clones being created

I made a clone counter and i guess you could use that to set a cap to the clones by putting the dots variable to whatever the amount of clones you need https://scratch.mit.edu/projects/509963143/
brax-boy
Scratcher
4 posts

Too many clones being created

asivi wrote:

Brontosplachna wrote:

The project is not shared, but I will remind you that clones receive and act on messages just like the original sprite does. So a script like
whenIreceivemessagecreatecloneofmyself

will create one new clone for each clone that receives the message.



That is the reason why the parent and its clone are needing a variable for that sprite only and to give different values for both.
whenclickedhidesetIdentifiertoparent
whenIreceiveifIdentifier=parentthensetIdentifiertochildcreatecloneofmyselfsetIdentifiertoparent
whenIstartasacloneshow. . .


Well how does that work without a message being broadcasted?
Cause I’m trying to make fruit ninja but it’s shot-gunning fruit and bombs, please help.
cs2722201
Scratcher
100+ posts

Too many clones being created

BigBadCheeseMan wrote:

Okay, it's probably a very simple fix, but in my project here, I have a set of scripts where one sprite will broadcast a message to create a clone, and then another sprite will be cloned. This works fine for about five seconds, then it starts to create clones way too quickly. am I overlooking something? help would be great!


EDIT: I just thought of switching the broadcast block for a cloning block, but it still make too many clones. While I'm at it, can anyone help me with giving the different clones different amounts of “health?” as well as creating a smooth, semi-random movement piece? that would be great!
to give each clone a different health make a new variable for this sprite only name it health set the health to whatever you before you clone then when you clone the clone will have a different health
https://scratch.mit.edu/projects/746208975/
check this link out and see what I did with the clone ids for an example
or check this project
https://scratch.mit.edu/projects/739395921/
go into enemies sprites go into custom block that spawns clones then see how I set the health to 1 before they get clones for a better example

Last edited by cs2722201 (Oct. 17, 2022 00:48:14)

Powered by DjangoBB