The Ultimate Guide To Clones

Woah, this is really detailed and well-written! Amazing job!

5 Likes

Nice! I wish there was a guide like this when I was trying to learn clones. I bet it’ll be helpful to those who don’t know this stuff yet.

4 Likes

yeah I definitely need this incase of a project
tysm!

4 Likes

Dude, this is epic! Super helpful tutorial!

2 Likes

@Awesomegirl25 This may help you.

3 Likes

I like it!

The first part is extremely similar to my clone tutorial. What are the chances :stuck_out_tongue:

2 Likes

Pretty cool!

2 Likes

oops lol I forgot you had one

3 Likes

Hi @Nobody

Here’s my favorite way to create clones. It wasn’t on your list.

I do this for several reasons.
• Efficiency. Doesn’t have an extra rule that the Player is continuously evaluating
• Timing. In advanced projects, sometimes you need the clones to start initializing at the same time as the Original Object
• Organization. Clean, well organized code helps prevent errors. (This is a theme of mine and is a key enabler to making more complex projects)

The custom rules keep things organized, but also make it easy to code both the original object and the clones (what is the original object other than just the 1st clone? I usually don’t need separate code just for the original object)

The Create Clones custom ability uses recursion (loops back to itself) like this until all the clones are created. And since both the original object and clones do this, the clones are created exponentially (really quickly).

Then after the Create Clones ability, I just use the second custom ability Initialize Object to put all the code that sets up the objects; color, position, passing data, etc

8 Likes

interesting, I’ve never seen this before

(@)leaders can one of you guys add this:

Method 4:

right under the sentence with the secret blocks link? thanks:)

4 Likes

Clone Index can also prevent accidental clones

If you, for example, had a project that clones and object with the tap of a button. It will not only clone the original object, but it will also clone its cloned object as well. This would lead to 3 clones instead of 2, then it would lead to 7 clones, 15 clones, etc. If you simply place a check once if (self(clone index))=(1), it will only clone the original object. There is a project that explains it very well, though I cannot find it. I also used clone index to alter certain objects in an old project I made, but I stopped working on it. I’m still making projects, though.

4 Likes

Thanks, I’ll see if I can make a project of my own

2 Likes

Clone Index is probably what I have found most helpful in HS through all my years, literally the best function, and this tutorial just makes even more people know about this. Simply Amazing!

2 Likes

Know i can make a one object game xd
(Buuuuuump)

2 Likes

Already done that in Flower Tapper. The project is also rising right now.

3 Likes

Im going to make a jump jump game

1 Like

Wow this was one month ago?

Huh, time goes fast lol

1 Like

I was poked :face_with_monocle:

1 Like

https://forum.gethopscotch.com/t/you-can-talk-about-your-hopscotch-coding-here-20-official/58028/7642?u=nobody

Here is another method too — method 4 with recursion from ThinBuffalo, but with a slight change to make it faster. It puts the recursive ability inside the Else part of Check if else (technique thanks to Petrichor.)

2 Likes