Discuss Scratch

birchyboii
Scratcher
100+ posts

Clone Problem!

http://scratch.mit.edu/projects/11650770/

Ok, for some reason, if you get the timing of the warp the same time an asteroid hits the bottom of the screen (I think this is when is happens) it spams the game with clones until the browser freezes. Why is this happening?? I had a bug free game and this stupid bug ruins it
PhirripSyrrip
Scratcher
500+ posts

Clone Problem!

birchyboii wrote:

http://scratch.mit.edu/projects/11650770/

Ok, for some reason, if you get the timing of the warp the same time an asteroid hits the bottom of the screen (I think this is when is happens) it spams the game with clones until the browser freezes. Why is this happening?? I had a bug free game and this stupid bug ruins it
How do you get the warp? I keep dying
I really need to recreate the bug before attempting a fix

Last edited by PhirripSyrrip (Aug. 21, 2013 14:35:49)


; ; ; ; ; ; ; ;You thought I'd get away from you, didn't you?!
birchyboii
Scratcher
100+ posts

Clone Problem!

go through the purple orb
DadOfMrLog
Scratcher
1000+ posts

Clone Problem!

My guess would be that you haven't taken into consideration that all clones receive broadcasts, not just the original sprite. So, if you have a sprite with a receive broadcast script that creates another clone, the number of clones will double (rather than just adding one more, as you may have intended).

A quick look at your asteroid scripts suggests this may well be what's happening…

Hope that helps!


Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

birchyboii
Scratcher
100+ posts

Clone Problem!

how'd you suppose I get around this?
birchyboii
Scratcher
100+ posts

Clone Problem!

It is a very uncommon glitch but It would be nice to fix it
CrystalStar-
Scratcher
100+ posts

Clone Problem!

You could make it so it only creates another clone if it itself isn't a clone (the original sprite).

Create a local variable in the asteroid sprite (call it IAmAClone? or something) and after ‘when gf clicked’, add in “set IAmAClone? to 0”. (0 will be the equivalent of no and 1 = yes).

Then after “when i start as a clone”, add “set IAmAClone? to 1”.

Finally, wrap a “if IAmAClone? = 0” around the cloning script.

Hope this helps!

CrystalStar-

Play Scramble here!
birchyboii
Scratcher
100+ posts

Clone Problem!

thanks, that may solve the issue! I'll implement it into the code as soon as I can
DadOfMrLog
Scratcher
1000+ posts

Clone Problem!

Yeah, that's the one - a local variable to say if you're a clone or not.

It's not that uncommon to find glitches caused by this - I've seen it several times in posts here (which is why it was the first thing I thought to suggest) - I mean, until you actually stop to think about it, and test it to see what happens with clones and broadcasts, it's not obvious that you need to guard against it…

Last edited by DadOfMrLog (Aug. 21, 2013 16:24:23)



Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

Powered by DjangoBB