Discuss Scratch

Dylanica
Scratcher
54 posts

Why is a Sprite Making Clones of Clones?

b00k_w0rm wrote:

Dylanica wrote:

b00k_w0rm wrote:

Dylanica wrote:

Is This a Bug? Are they planning on fixing it soon. Its really annoying. If it is not a bug Please! Remove it.


No, as far as I know, it isn't a bug, but it sure is annoying sometimes.

Somewhere in the discussion is an explanation for why that happens….I think it's because the “Create clone of myself” block, when not under the “when I start as clone” block, applies to the sprite and all existing copies of the sprite, therefore creating multiple clones.

-b00k_w0rm-

It basicly just ruined a project i was working on. Or else id have to rework all of the programming. And some of my other projects are ruined also.


What's not working in your project? I can attempt to help….

-b00k_w0rm-

No i know what was wrong its just that it'll be tedious to fix it. the other projects were quick fixes.

when I receive [Cookies v]
repeat until <(Cookies) = [ 0]>
play sound [Happy Noises v]
change [Cookies v] by (-1)

end
Daweirdo
New to Scratch
2 posts

Why is a Sprite Making Clones of Clones?

I'm still confused to how to only make 1 clone and the ID part can anyone help me?
Daweirdo
New to Scratch
2 posts

Why is a Sprite Making Clones of Clones?

Daweirdo wrote:

I'm still confused to how to only make 1 clone and the ID part can anyone help me?
Never Mind
Locomule
Scratcher
1000+ posts

Why is a Sprite Making Clones of Clones?

Ton of nfo in the “Clones” section here.
Locomule
Scratcher
1000+ posts

Why is a Sprite Making Clones of Clones?

I just made this tutorial project on controlling individual clones. See inside for the script comments for a full explanation of how this project works.

To test it, click the green flag. Nine clones will be spawned. You can interact with them in two ways…
1. Touch one with your mouse cursor and it will tell you its unique ID number.
2. Press any number 1 through 9 and the corresponding clone will spin. You can spin more than one clone at a time.
Creeper521
Scratcher
49 posts

Why is a Sprite Making Clones of Clones?

Cloning Issues. I have the same problem, but none of your ideas are working. I want to make a clone of the sprite, and it makes a clone of the sprite and the clone! Anyone know how to fix it? I tried making the clone change costumes, and “if costume # = 1 then create clone” but that didn't work either. Here's my script:
when I receive [buy cat v]
add [cat] to [animals v]
create clone of [myself v]

when I start as a clone
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (26))
forever

if <(backdrop name) = [land]> then
show
play sound [pop v]
else
hide
end

end

Then, when it creates the clone the next time, it makes 2 instead of 1. Then 4, then 8, then 16, and so forth.

Last edited by Creeper521 (Feb. 8, 2015 23:42:20)

Arcanum
Scratcher
57 posts

Why is a Sprite Making Clones of Clones?

Creeper521 wrote:

Here's my script:
when I receive [buy cat v]
add [cat] to [animals v]
create clone of [myself v]

when I start as a clone
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (26))
forever

if <(backdrop name) = [land]> then
show
play sound [pop v]
else
hide
end

end

Then, when it creates the clone the next time, it makes 2 instead of 1. Then 4, then 8, then 16, and so forth.
Your problem is that each time you broadcast ‘buy cat’ all the clones receive the message, and so they all create a clone.

You could try setting a variable to decide if it is the original and so if it should generate a clone.
when flag clicked
set [Original v] to (0)

when I receive [buy cat v]
if <(Original) = (0)> then
add [cat] to [animals v]
create clone of [myself v]
end

when I start as a clone
change [Original v] by (1)
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (26))
forever
...
end
amoorestl
Scratcher
18 posts

Why is a Sprite Making Clones of Clones?

Arcanum wrote:

Creeper521 wrote:

Here's my script:
when I receive [buy cat v]
add [cat] to [animals v]
create clone of [myself v]

when I start as a clone
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (26))
forever

if <(backdrop name) = [land]> then
show
play sound [pop v]
else
hide
end

end

Then, when it creates the clone the next time, it makes 2 instead of 1. Then 4, then 8, then 16, and so forth.
Your problem is that each time you broadcast ‘buy cat’ all the clones receive the message, and so they all create a clone.

You could try setting a variable to decide if it is the original and so if it should generate a clone.
when flag clicked
set [Original v] to (0)

when I receive [buy cat v]
if <(Original) = (0)> then
add [cat] to [animals v]
create clone of [myself v]
end

when I start as a clone
change [Original v] by (1)
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (26))
forever
...
end

Make sure the variable is for the sprite only…not for all sprites…that will guarantee that each clone of the sprite gets its own copy. However, I think instead of changing it by one (because it doesn't yet exist in the specific clone), you will need to set it to something other than 0. I'm not sure how changing a variable that hasn't been set is handled in Scratch. If you need to keep a count of the clones, you would need a global counting variable and then set the clone variable equal to the count variable when you create the clone each time.
deck26
Scratcher
1000+ posts

Why is a Sprite Making Clones of Clones?

amoorestl wrote:

Arcanum wrote:

Creeper521 wrote:

Here's my script:
when I receive [buy cat v]
add [cat] to [animals v]
create clone of [myself v]

when I start as a clone
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (26))
forever

if <(backdrop name) = [land]> then
show
play sound [pop v]
else
hide
end

end

Then, when it creates the clone the next time, it makes 2 instead of 1. Then 4, then 8, then 16, and so forth.
Your problem is that each time you broadcast ‘buy cat’ all the clones receive the message, and so they all create a clone.

You could try setting a variable to decide if it is the original and so if it should generate a clone.
when flag clicked
set [Original v] to (0)

when I receive [buy cat v]
if <(Original) = (0)> then
add [cat] to [animals v]
create clone of [myself v]
end

when I start as a clone
change [Original v] by (1)
go to x: (pick random (-220) to (220)) y: (pick random (-160) to (26))
forever
...
end

Make sure the variable is for the sprite only…not for all sprites…that will guarantee that each clone of the sprite gets its own copy. However, I think instead of changing it by one (because it doesn't yet exist in the specific clone), you will need to set it to something other than 0. I'm not sure how changing a variable that hasn't been set is handled in Scratch. If you need to keep a count of the clones, you would need a global counting variable and then set the clone variable equal to the count variable when you create the clone each time.
The clone will inherit the value of Original from the main sprite so changing it by 1 will work but it will result in all clones having the value 1 for Original which may be enough in this instance.
Domestic-_-Melon
Scratcher
67 posts

Why is a Sprite Making Clones of Clones?



Play A 900+ Viewed Skydiving Game Here!
Watch A Front Paged Animation Here!
Want A Collaboration? Ask Me Here!
Follow Me Here!





Locomule
Scratcher
1000+ posts

Why is a Sprite Making Clones of Clones?

Just look at the script comments inside that tutorial project I made and linked to in an earlier post. It covers and explains all this.
awesomecatD
New to Scratch
2 posts

Why is a Sprite Making Clones of Clones?

why do clones make clones of clones


when green flag clicked
forever
wait (1) secs

create clone of [ myself]
end
and then it goes 1 clone, 2, 4, 8, 16, 32
grrrr
deck26
Scratcher
1000+ posts

Why is a Sprite Making Clones of Clones?

awesomecatD wrote:

why do clones make clones of clones


when green flag clicked
forever
wait (1) secs

create clone of [ myself]
end
and then it goes 1 clone, 2, 4, 8, 16, 32
grrrr
Please start your own topic rather than necroposting.

Basically sprites can clone themselves and so can clones. If you do something like

when [space v] key pressed
create clone of [myself v]
then the sprite will clone itself but any clones that exist at the time the key is pressed will also do so. Perfectly sensible really.

Last edited by deck26 (April 3, 2016 19:01:27)

awesomecatD
New to Scratch
2 posts

Why is a Sprite Making Clones of Clones?

clones make clones which makes clones of themself as well so I don't know really how you can stop it
FlubbaFish
Scratcher
62 posts

Why is a Sprite Making Clones of Clones?

The first comment was the most accurate and simple. If you want to stop clones making clones of itself do the make a clone in another sprite like this.

Not this
create clone of [Myself v]


But this
create clone of [That guy v]

Why don't you check out some of my games.
Learn to take care of chickens:Chicken Caring Simulator
Blast some Asteroids and HiScores in: Asteroid Shooter!
Put your friends (and enemies) to shame in my new multiplayer game warships: Warships
Love Science? If yes click on this link to go to Molecule Maker:Molecule Maker

FlubbaFish
Scratcher
62 posts

Why is a Sprite Making Clones of Clones?

Thanks for Helping.

Why don't you check out some of my games.
Learn to take care of chickens:Chicken Caring Simulator
Blast some Asteroids and HiScores in: Asteroid Shooter!
Put your friends (and enemies) to shame in my new multiplayer game warships: Warships
Love Science? If yes click on this link to go to Molecule Maker:Molecule Maker

JC_Games
Scratcher
3 posts

Why is a Sprite Making Clones of Clones?

b00k_w0rm wrote:

Hi!

I'm working on a game involving clones, and I've run into a problem: For some reason, each time the “create clone of myself” block is run, clones of existing clones as well as the most recent clone are created. (Two clones each clone themselves to make four clones, instead of one clone cloning itself to make three clones (including the one existing clone)).

Is this supposed to happen? If so, is there some way of preventing it?

Here is a link to the project. It's still in its very early stages: http://scratch.mit.edu/projects/26848318/#player

-b00k_w0rm-

I had the same problem too.
I solved it by using this method:
when [space v] key pressed
set [CloneSpawn v] to [1]
wait (0.0000000001) secs
set [CloneSpawn v] to [0]


when green flag clicked
forever
wait until <(CloneSpawn) = [1]>
create clone of [myself v]
wait until <(CloneSpawn) = [0]>
end

Last edited by JC_Games (May 11, 2017 11:41:10)

Funny132
Scratcher
12 posts

Why is a Sprite Making Clones of Clones?

make a variable called “am I a clone?” and have a
when green flag clicked
set [am I a clone? v] to [0]
when I start as a clone
set [am I a clone v] to [1]
when I receive [create clone of myself v]
if <(am I a clone) = [0]> then
create clone of [myself v]
end

make sure the variable is set to “for this sprite only” otherwise every clone will use the real sprite's variable
Ibuildfortnite
Scratcher
22 posts

Why is a Sprite Making Clones of Clones?

My clones are reading the green flag block and not the when i start as a clone block.
when I start as a clone
set [ I am a clone] to [yes]
when green flag clicked
set [ I am a clone] to [no]

I even tried that and it doesn't work!

Last edited by Ibuildfortnite (July 12, 2020 17:31:48)

joshuaho
Scratcher
1000+ posts

Why is a Sprite Making Clones of Clones?

Hey folks - this thread is old. If you have a new question about your project scripts, then please feel free to make a new topic. It would also be a good idea to share your project and provide a link to it. Doing both makes it easier for others to find your question and see what needs to be fixed.

College student studying Communication and Fire Technology, communication lab tutor, guitar and piano player, perfectionist, and just some guy who regularly eats and trains physically to stay healthy.

Powered by DjangoBB