Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Creating too many clones causes problems
- mrsteve
- Scratcher
100+ posts
Creating too many clones causes problems
There needs to be a “less confusing” way to deal with someone creating “too many clones”.
In project Guess My Balance
I create a set of clones of a red dot to mark where the last 10 guesses occurred. But if I press the space bar too many times (the space bar sends the message to create 10 clones) I wind up seeing only 3 red dots, then none.
Yes I could script it to delete the previous set of clones or I could also use stamp and clear. But, how will kids figure that out?
Some ideas to resolve (none of which I like that much, with #4 showing the most promise)
1) provide a delete all clones block
2) provide a warning when creating too many clones
3) Document the limitation
4) Find someone smarter than me to come up with a good solution
Cheers,
Stephen
In project Guess My Balance
I create a set of clones of a red dot to mark where the last 10 guesses occurred. But if I press the space bar too many times (the space bar sends the message to create 10 clones) I wind up seeing only 3 red dots, then none.
Yes I could script it to delete the previous set of clones or I could also use stamp and clear. But, how will kids figure that out?
Some ideas to resolve (none of which I like that much, with #4 showing the most promise)
1) provide a delete all clones block
2) provide a warning when creating too many clones
3) Document the limitation
4) Find someone smarter than me to come up with a good solution
Cheers,
Stephen
“If you give a child an answer, you solve a problem for a day,
If you teach a child to find the answers, you prepare her for life.”
- Mr. Steve's Science
- johnm
- Scratcher
100+ posts
Creating too many clones causes problems
The limit is 300 clones. That will eventually get documented.
A “delete all clones” block would be useful, but we try hard to minimize the number of blocks. However, if there's a strong enough case for it then it could get added in the future. (And it would definitely help with this project…)
The problem with this project is that it creates an exponential explosion of clones, because every clone also responds to the space key. So, the first time you hit space you get 10 clones, plus the original sprite. The next time you hit space you get 110 new clones, resulting in 120 total clones plus the original object. The third time you hit space you'd get 1210 additional clones – except that you hit the limit. And that's exactly why we have that limit! It's easy to create runaway cloning projects like this; I've done it myself many times. The clone limit keeps your computer from grinding to a halt as it tries to process vast numbers of clones.
One solution to this problem is to put the “when space key pressed” script in a sprite hat does not get cloned. But that raises the problem of how to position the clones. One way to do that is be to have a “clone dropper” sprite that moves to each position and creates a clone of the clone prototype (a different sprite). The clone prototype would have a “when cloned” script containing a “go to ‘clone dropper’” and a “show” command.
Hope that helps…
A “delete all clones” block would be useful, but we try hard to minimize the number of blocks. However, if there's a strong enough case for it then it could get added in the future. (And it would definitely help with this project…)
The problem with this project is that it creates an exponential explosion of clones, because every clone also responds to the space key. So, the first time you hit space you get 10 clones, plus the original sprite. The next time you hit space you get 110 new clones, resulting in 120 total clones plus the original object. The third time you hit space you'd get 1210 additional clones – except that you hit the limit. And that's exactly why we have that limit! It's easy to create runaway cloning projects like this; I've done it myself many times. The clone limit keeps your computer from grinding to a halt as it tries to process vast numbers of clones.
One solution to this problem is to put the “when space key pressed” script in a sprite hat does not get cloned. But that raises the problem of how to position the clones. One way to do that is be to have a “clone dropper” sprite that moves to each position and creates a clone of the clone prototype (a different sprite). The clone prototype would have a “when cloned” script containing a “go to ‘clone dropper’” and a “show” command.
Hope that helps…
- mrsteve
- Scratcher
100+ posts
Creating too many clones causes problems
John,
Thanks, that helps. I will use stamps and clear, thus avoiding clones altogether.
Thanks, that helps. I will use stamps and clear, thus avoiding clones altogether.
“If you give a child an answer, you solve a problem for a day,
If you teach a child to find the answers, you prepare her for life.”
- Mr. Steve's Science
- learnegy
- Scratcher
100+ posts
Creating too many clones causes problems
mrsteveBeware of the bitmap stamp
I will use stamps and clear, thus avoiding clones altogether.
Last edited by learnegy (Jan. 23, 2013 14:02:29)
2.0 Alpha Tester • Scratch instructor and fan!
“Some like to build and some like to play. You can do both with Scratch every single day.”
- scimonster
- Scratcher
1000+ posts
Creating too many clones causes problems
johnmhttp://wiki.scratch.mit.edu/index.php?title=Cloning&curid=5984&diff=55113&oldid=50008
The limit is 300 clones. That will eventually get documented.
Is it per-sprite or per-project?
Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.
418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
- mrsteve
- Scratcher
100+ posts
Creating too many clones causes problems
learnegymrsteveBeware of the bitmap stamp
I will use stamps and clear, thus avoiding clones altogether.
Thanks, did not know that. I should be fine, but good to know.
“If you give a child an answer, you solve a problem for a day,
If you teach a child to find the answers, you prepare her for life.”
- Mr. Steve's Science
- johnm
- Scratcher
100+ posts
Creating too many clones causes problems
scimonster
Is it per-sprite or per-project?
Thanks for documenting this. The limit is per project.
- Discussion Forums
- » Bugs and Glitches
- » Creating too many clones causes problems