I know many of you are like when you see the Sin and Cos blocks. But using them is not that complicated! Here’s a tutorial for anyone struggling with Sine and Cosine:
1. Pull out a Blank Text Object
2. Pull out an Emoji
Next you will need to pull out an emoji or some other text object. Today I’m going to use the basketball emoji.
3. Add a Set Pos Block
Create a new rule for the basketball emoji and pull out a Set Position block.
4. Place the Cos Block
Now Place the Cos block inside the X slot on the Set Position block.
5. The Three Slots
I will now explain what the three slots on the sin/cos blocks mean and how to use them.
For the first slot you will want to type in a number. This number will determine how far your object is from the object it is rotating around.
In the second slot you will want to place a value. This will determine the speed of your object.
The last slot will determine what X and Y positions your object will rotate around. If you are making your object rotate around another object, place the values Text X Position and Text Y Position in this slot.
We will now do the same with the Sine block.
Next we need to place this block in a Repeat Forever block.
We now need to make another rule on the basketball where it says, when the play button is tapped, Repeat Forever.
Inside this block we will place an Increase Value block with our value Length inside it.
Now we just need to change the amount you increase the value by in order to change the speed of the basketball. The higher the number, the faster the basketball rotates. 5 will be the default speed.
YAY! You have now learned to properly use Sine and Cosine in Hopscotch! Go mess around with the functions and clones and see what you can create!
THIS LINK is to the final product!
Was this tutorial helpful?
Thank you guys for the Feedback! Ask questions below!