Discuss Scratch

CrownIR1
Scratcher
100+ posts

Clone Increase [✔ Solved]

I'm making a clicker game, I just put edited 2 scripts so that when your points increase, it creates a clone and there's also a script that makes them fall and fade. but, when you click on the button for the first time it's normal, but then, when you press it again, it creates 2 clones. And it keeps multiplying by 2.

Heres the project: https://turbowap.org/82010459/editor

please help. –CrownIR1

Last edited by CrownIR1 (Dec. 6, 2021 06:31:43)

cIoudyness
Scratcher
500+ posts

Clone Increase [✔ Solved]

just before viewing the project, it's likely that your cloning script is under a broadcast loop that the main sprite and the clones are receiving, and the clones are cloning themselves

(at least that's what im guessing)

to fix this, use for this sprite only variable identifiers or maybe cloning specifically only if the costume is a specific number or something
CrownIR1
Scratcher
100+ posts

Clone Increase [✔ Solved]

cIoudyness wrote:

just before viewing the project, it's likely that your cloning script is under a broadcast loop that the main sprite and the clones are receiving, and the clones are cloning themselves

(at least that's what im guessing)

to fix this, use for this sprite only variable identifiers or maybe cloning specifically only if the costume is a specific number or something
I don't understand that very well, I have a hard time understanding stuff

Last edited by CrownIR1 (Dec. 6, 2021 02:47:14)

TheTenthPlanet
Scratcher
34 posts

Clone Increase [✔ Solved]

possibly theres an error with the cloning that you made that makes the clones clone themselves and here is how to fix it

(BEFORE DOING THIS MAKE SURE TO CREATE A VARIABLE NAMED CLONE? AND SET IT TO THIS SPRITE ONLY )
when green flag clicked
set [CLONE? v] to [0]
Insert some other scripts.



when I start as a clone
set [CLONE? v] to [1]
Insert some more scripts

when I receive [ Just choose v]
if <(CLONE? ) = [0]> then
create clone of [myself v]
change x by (Some random number)
end

Last edited by TheTenthPlanet (Dec. 6, 2021 03:01:28)

CrownIR1
Scratcher
100+ posts

Clone Increase [✔ Solved]

TheTenthPlanet wrote:

possibly theres an error with the cloning that you made that makes the clones clone themselves and here is how to fix it

(BEFORE DOING THIS MAKE SURE TO CREATE A VARIABLE NAMED CLONE? AND SET IT TO THIS SPRITE ONLY )
when green flag clicked
set [CLONE? v] to [0]
Insert some other scripts.



when I start as a clone
set [CLONE? v] to [1]
Insert some more scripts

when I receive [ Just choose v]
if <(CLONE? ) = [0]> then
create clone of [myself v]
change x by (Some random number)
end

there's a new problem, its better to show in video form: https://youtu.be/gK0xtIvpYls
Thingied
Scratcher
1000+ posts

Clone Increase [✔ Solved]

Just replace the broadcasts with the actual block. It fixes the problem and makes the code simpler.
CrownIR1
Scratcher
100+ posts

Clone Increase [✔ Solved]

Thingied wrote:

Just replace the broadcasts with the actual block. It fixes the problem and makes the code simpler.
Thanks!

Powered by DjangoBB