Only 9 clones allowed?!?

hopscotch
bug
helpwithcode

#1

I have this game I was making and my worst enemy came along! A clone glitch!!!! So, you can tap somewhere and a block will appear. But this can only happen 9 times!!!!! Whyyyyyyyy?!? It took me a while to think of a name for it, and now a glitch is here!!!! Help me get rid of this glitch! Pleeeaaasseee it's the only game someone is interested in! More specifically, @Phase_Studios. Please help me @Ian, @Liza, whoever can! Please! :cold_sweat:


Help With Clones and Deletion of Clones
#2

Are you doing a pressed or tapped rule? @Hoppertoscotch


#3

@Phase_Studios tapped.


#4

Ok @Hoppertoscotch, so in your tapped rule, make sure you have the make the clone and set poistion x and y last touch in that rule. Make a new rule and make it when (character is cloned) then inside of it have an (set position; (last touch X) ; (last touch Y). Do it.


#5

That's what I did!


(Example)


#6

@Hoppertoscotch, Oops, delete the rule for when the character is cloned. I think it will work. And first of all, what are you making?


#7

Oh, it's the thing I talked about and you wanted to beta test. Also, the Chinnchilla thing was I just made a project to see if it was a glitch and took a picture of that.


#8

Wait I just realized what I'm supposed to do, but why could I only do 9 clones anyways?


#9

I do not know? You should email The Hopscotch Team about team about that, it is very weird and bad.


#10

Oh and what I thought I was supposed to do was even more glitchy. I will email the hopscotch team. I guess I can't make this for a while. Sorry, @alish!


#11

So, @Hoppertoscotch, did you get a good answer, or do you still have a question about this? I haven't looked at your code, but i see "9" and i immediately think "512". And the reason that is relevant is that 2^9 is 512, and 512 is the limit on how many clones you can make in Hopscotch.

When i had a similar problem, i learned that i needed to have a way to make sure i was just "cloning" the original character, instead of cloning it and every clone that had already been generated. I can show you a fix, if you still need one.


#12

Yes, I need a fix. I discovered that it is technically 8, but 9 if you count the base charecter that makes the clones. Please tell me the fix!


#13

Ok.

Well, I learned from Alish or Ian or maybe somebody else that a similar problem that I ran into could be solved by first making the thing that you want to clone have its invisibility set to a specific value. Then you would use an "IF" block to clone only that (original) character that has the invisibility value that you set. Seems kind of strange, I know. But it works. I'll lay-out two examples.

Example 1: Suppose you didn't want the "original" object to be visible at all, but you wanted to use it for cloning. I usually do that. You could then start with a "Set invisibility" value of 100% on the "when play button is pressed" block for the original object. Then, when you produce clones (I would assume that you want them to be visible) you'll just let them pop into existence and remain with invisibility of 0%. The trick is that in your "when [such and so] is tapped" (or whatever) block, you don't just "create a clone". That would clone EVERYTHING, including any clones already in existence. What you do is stick a "If Invisibility as a % = 100" inside of the "when [such and so]..." and you create your clone inside this "If..." structure. That way, the only object that gets cloned is the original, with its invisibility set to 100%.

Voila! One tap, one clone.

Ok, but you might not like that example, because it has the original set to be invisible. So, then...

Example 2: You start out with the original getting its invisibility set to the smallest possible value, which I assume to be 1%. Ok, so then the rest of the approach is the same as in the first example, except that you just use "If invisibility as a % = 1" and "create a clone" inside of that. Of course the clones will default to 0% invisibility, so, again, the code can distinguish the original from the clones.

Hopefully that gets you going.


#14

It worked! But, I have a question, how does it work? The cloning charecter always is 100 % invisible! So, how did that work? This is out of curiosity.


#15

I am glad to hear that this has solved your problem. It works for me as well.

To respond to your question, any time we ask, "why?" It kind of sends us on a journey down some rabbit hole or into a nested set of "why" questions. I suppose the real answer can only be found in the source code for Hopscotch itself. As far as why it should work the way it does, I guess the cloning operation has to be thought of as cloning the object as it exists in your code editing screen, and not as it may exist due to things that happen after you press the start button. Another way of saying that is that we are not cloning the invisibility of the original character, when we clone the character. That seems kind of illogical to me, too, since we're calling the generated object a "clone", and a clone is dupposed to be identical to its source, but the explanation seems to hold.


#16

Hmmm. I see. THIS NEEDS TO BE 20 CHARECTERS SORRY I'M ANGRY AT THIS RULE


#17

What's your username? And what's the game name


#18

@friendship2468 oh, no thanks. It's all fine now. But thank you for offering.