Discuss Scratch

flamesscratch
Scratcher
10 posts

multiple clones are created from 1 clone block

the title says it all. so i am making a cuphead clone game, and i uses a different sprites for the boss (who cloned the bullets) and the bullet (the one that is
cloned)

anyone have any idea of how to fix this?

here is the full project https://scratch.mit.edu/projects/882072649/
mmhmBeans
Scratcher
500+ posts

multiple clones are created from 1 clone block

I couldn't figure out the issue, but clones are actually being created with the normal rate. It seems like they are moving after touching the edge instead of being deleted.
flamesscratch
Scratcher
10 posts

multiple clones are created from 1 clone block

do that actually means i cant fix it
oh well

Last edited by flamesscratch (Aug. 19, 2023 11:41:22)

StampDanFan
Scratcher
100+ posts

multiple clones are created from 1 clone block

My guess is that the “create clone block” is being run multiple times: once by the main sprite, and once by the clones.
If you are creating clones from a broadcast event / when gf clicked event, both the main sprite and all clones will create a clone, leading to multiple of them.

flamesscratch wrote:

here is the full project https://scratch.mit.edu/projects/882072649/
If you don't mind, could you reshare the project? I might be able to take a closer look.

One way you could avoid this is by:
creating a variable “for this sprite only”,
setting it to 1 before creating a clone and setting it to 0 after creating a clone.

Since “for this sprite only” local variables can be different between the main sprite and clones, you can wrap the clone creation script in an if block, and only let the main sprite create a clone.
For more info, I created a Cloning Tutorial on Scratch
ledude12
Scratcher
21 posts

multiple clones are created from 1 clone block

I had to overcome this problem you have to make two variables one thats for all sprites and one thats for this sprite only. you need to change both of the variables every time you make a new clone.
whenclickedchangeclone count(forallsprites)by1ifIndex(forthisspriteonly)=clone count(forallsprites)thencreatecloneof mechangeIndex(forthisspriteonly) by (1)

Last edited by ledude12 (Aug. 19, 2023 18:14:12)

flamesscratch
Scratcher
10 posts

multiple clones are created from 1 clone block

StampDanFan wrote:

My guess is that the “create clone block” is being run multiple times: once by the main sprite, and once by the clones.
If you are creating clones from a broadcast event / when gf clicked event, both the main sprite and all clones will create a clone, leading to multiple of them.

flamesscratch wrote:

here is the full project https://scratch.mit.edu/projects/882072649/
If you don't mind, could you reshare the project? I might be able to take a closer look.

One way you could avoid this is by:
creating a variable “for this sprite only”,
setting it to 1 before creating a clone and setting it to 0 after creating a clone.

Since “for this sprite only” local variables can be different between the main sprite and clones, you can wrap the clone creation script in an if block, and only let the main sprite create a clone.
For more info, I created a Cloning Tutorial on Scratch

YOOOO THIS WORKS THANK YOU SO MUCH
StampDanFan
Scratcher
100+ posts

multiple clones are created from 1 clone block

Cool, glad I could help!
FabeBread7
Scratcher
1 post

multiple clones are created from 1 clone block

StampDanFan wrote:

My guess is that the “create clone block” is being run multiple times: once by the main sprite, and once by the clones.
If you are creating clones from a broadcast event / when gf clicked event, both the main sprite and all clones will create a clone, leading to multiple of them.

an easy fix is to put the broadcast script into an if block and create a variable called “id” and at the start set it to clone and after set it back to “main sprite”. Don't forget to put a when flag clicked and then set “id” to main sprite

Powered by DjangoBB