# Help with projects: How-tos

#1

Wanna learn a new skill? Or show off something you’ve mastered? You’re in the right place.

Use this thread to learn how to do something, like use “Create a clone” or make a platformer game. Teach others how to make cool stuff by sharing your skills, like your favorite way to implement gravity.

Together, we all get smarter

How-tos: Hopscotch Tips and Tricks
Help? I am new!
Gobli's General Topic II 🤔
#3

Yay! I've been waiting for this. Ok, I have a question. How do clones work? I get that when you use a Create Clone block your character makes a clone. But then it doesn't always do what I made the original character do. What are the rules with clone?

#5

For me, the secret to making clones work is incrementing a value as the clones are created. Then, in a "when cloned" rule, I can use that value to adjust that clone's position or appearance.

Here is a quick sample of how I tend to use a value to make clones work.

## Rules for Gorilla

When project is played
Repeat 100 times
- Create a clone
- Increase value Clones by 1

When character is cloned
Set position to GorillaX + Clones, GorillaY + Clones

When you make this, you'll see a diagonal line of Gorillas. That's because each clone, when it is newly created, changes its position based on the original Gorilla's X & Y. But, we adjust the X&Y by the Clones value, which is different for each clone. So, each clone gets drawn with a slightly larger X&Y.

The beauty of this technique is that you can use the value for other things too, like size and invisibility level.

Anyhow I hope this helps!

~Josh

#6

Here are a few other tips with clones in case anyone else is wondering about clones too:

• When a clone is first created, it will appear at the original character's starting position

• The When the character is cloned, make the clone.... rule only appears once you've used a Create a Clone block in your code for that character.

• Every rule that you make for the original character applies to ALL its clones, except for rules starting with When the play button is tapped

split this topic #7

I moved 2 posts to a new topic: Make an emoji wave?

#9

That’s a great question!

Clones have their very own “When”. It’s called “When Character is Cloned”. When clones are made, you’ll see this new “When” in the object’s “When” menu.

Use this “When” to get a clone to do something the moment it is created. It’s basically like “When the Play button is tapped” for clones.

Because of this, clones ignore any rules that actually start with “When the Play button is tapped”. Only the original character is controlled by this “When”.

Now, what if you want to do something based on a clone’s size or position? Like in this example—let’s say you’re working with bear and bear has created a bunch of clones.

This code says when Bear’s x position = 500, do a backflip. But which bear are we talking about, the clone or the original? Does this make it so if the original bear is at 500 all the clones do a backflip? Or if any clone is at 500 then that specific clone does a backflip?

The answer depends on which When you use. If you’re using either “When the play button is tapped” or “When character is cloned” then any traits you use in these rules are a reference to the original bear’s traits. (Traits are values that describe an object, things like “x position”, “size” or “invisibility %”.)

So in the above case, any time original bear is at 500, all the clones would do a backflip.

If the above code is in any other “When” other than those two, then the trait “bear’s x position” actually means “This specific clone’s x position”. So for example, let’s say you have a rule that starts with “When 7 = 7” (which is just another way of saying always/repeat forever), and inside it you wrote the same code as before:

Because this “When” is neither “When the play button is tapped” nor “When Character is cloned”, “Bear’s x position” now means the clone’s x position. In this case, each clone would do a backflip when that specific clone is at 500, regardless of where the original bear is.

We hope to add "self" attributes to make this all a lot clearer/more easily controllable soon. Then you’ll be able to distinguish “this clone’s x position” from “original bear’s x position” directly, which will be gggggggreat. Stay tuned!

#10

What are “sin” and “cos”? I see them in the calculator and I don’t understand what these blocks do. Thanks!

#11

Ahhhh yes…“sin” and “cos” are actually short for Sine and Cosine…a somewhat unsual but fun part of mathematics. Your math teacher is gonna be shocked when you show up to class knowing them like a boss. Which you totally can.

Sine and cosine relate the angles of a triangle to the lengths of its side. They turn out to be crazy useful as a way to draw or move in circles.

Now, here’s how to use them in Hopscotch. In this example we’re going to make Octo orbit around a sun:

1) We're going to set Octo's position to change as he orbits around the sun. So create a new rule with a "Set Position" block.

2) We're going to change his position using a new value, "Theta". It will refer to the angle between Octo and the sun. The starting point for this value assumes that Octo is to the right of the sun. At this point, the angle between him and the sun (Theta!) is 0 degrees. If he moves directly above the sun, he'd be 90 degrees above it (theta=90.) If he's directly to the left of the sun, theta would be 180. Does that make sense? So, first, create this new value called "theta".

3) In the x coordinate of the "Set Position" block, choose "Cosine" under the calculator. An equation will automatically populate, and in the bubble to the right of “cos”. Put in your new value “Theta" in it. The bubble to the left of cos (where the 100 is) tells you how much farther to the left or right Octo is from the center of the circle. That bubble to the right of "cos" sets the center of the circle. Here's a screenshot:

4) In the y coordinate of the "Set Position" block, choose "Sin" under the calculator. An equation will automatically populate, and in the bubble to the right of "sin", put in your new value "Theta". Here's a screenshot.

5) Put this set position block in a repeat forever.

6) Create a new rule that increases theta's value by 1. Put that in a repeat forever loop.

AAAAAAAAAND YOU’RE DONE! Now, watch Octo orbit!!

7) If you put the code with set position inside a “Leave a Trail” block, you'll then draw a circle behind octo as he moves.

8) Play around with the numbers to see how they change the height and width of the circle.

Phew. That was a lot. I’m tired. Are you? If you have other questions, reply with them! Play around with these blocks and you’ll be wowing the community (and your friends in math class) in no time.

What are "Sin" and "Cos"?
How do you use sin and cos
#12

## HELP!

#13

Hi @Bubblyoreo I posted a message on Posting a topic. Tap the link to open it

#14

Thanks t1 you are a huge help. Also do you have another account because it says since July 2015 or is that a glitch if so I will follow you.
P.s YOU ARE ONE OF MY FAVOURITE HOPSCOTCHERS. Also want to do a project together or work on a project saying about this sight
Thanks from B.O

#15

Thanks so much Lavendercupcake!

#16

How to make a clone

First put in when the play button is tapped repeat forever than put create a clone and set position to random y to 1000 and random X to 1000

Then do it the same but in when character cloned.

Please like for more help on how to reply with what you want to know.

#17

So many tutorials.......... So useful....

#18

This thread is now the entire forum premise

#19

Hello. I was wondering… Well, I’m making a project where you type things. I want to change the case of characters. Please tell me how I can press Change Case once (and it will make it a) and press it again (to make it A). ??