Discuss Scratch

nooblecool
Scratcher
13 posts

why my clone code clones multiple times??

why my clone code clones multiple times??
if <(food) > [1]> then
create clone of [myself v]
end

Last edited by nooblecool (Aug. 17, 2021 06:23:47)


define wut
forever
repeat until <i rember>
i forgor
end
forgor again
end
Vaibhs11
Scratcher
1000+ posts

why my clone code clones multiple times??

have you put it in a forever loop?
nooblecool
Scratcher
13 posts

why my clone code clones multiple times??

i didnt put it in loop

define wut
forever
repeat until <i rember>
i forgor
end
forgor again
end
Vaibhs11
Scratcher
1000+ posts

why my clone code clones multiple times??

nooblecool wrote:

i didnt put it in loop
can you share the project and share the link?

Reporting to be moved to HWS
vineet_wibyte
Scratcher
28 posts

why my clone code clones multiple times??

Is this under a broadcast? If yes, then ALL the clones may start cloning. To avoid this, you will have to use variables ONLY for this sprite.

Cheers!
kccuber
Scratcher
1000+ posts

why my clone code clones multiple times??

Try creating clones from a different place like the stage or another sprite


Made using Nord Theme & Inkscape
nooblecool
Scratcher
13 posts

why my clone code clones multiple times??

vineet_wibyte wrote:

Is this under a broadcast? If yes, then ALL the clones may start cloning. To avoid this, you will have to use variables ONLY for this sprite.

Cheers!
i dont have broadcast in the code
i used variables only for this sprite

Last edited by nooblecool (Aug. 26, 2021 01:19:06)


define wut
forever
repeat until <i rember>
i forgor
end
forgor again
end
Vaibhs11
Scratcher
1000+ posts

why my clone code clones multiple times??

Vaibhs11 wrote:

can you share the project and share the link?
samq64
Scratcher
1000+ posts

why my clone code clones multiple times??

Make sure that only the original sprite is doing the cloning and not the clones themselves.

when green flag clicked
set [clone v] to [0] //For this sprite only

when I start as a clone
set [clone v] to [1]

when I receive [whatever v]
if <<(food) > (1)> and <(clone) = (0)>> then
Create clone of [myself v]
end

Last edited by samq64 (Aug. 27, 2021 00:22:30)

Powered by DjangoBB