Tankt’s Code Tutorials On Random Stuff

tutorial
fish-and-guac
#44

Yah, but it got to crowded over there.

#45

so this got merged…
(I had nothing to do with the merging lol)

#46

Hey! HR had a reason. Several leads have discussed this and we are also backed by @Ana and @Jazz. An explaination has already been given by @HopscotchRemixer.

3 Likes
#47

Why can’t someone make a tutorial on how to use clone index? I think that would be helpful for many hopscotchers.

2 Likes
#48

I confirm. Let’s keep it relevant guys.

4 Likes
#49

What tutorial should I make⬇️

  • Variables
  • Clone Index
  • Sine and Cosine
  • Other Things (reply) :wink:

0 voters

#50

Ima do a drawing pad tutorial today
Should I rename this topic a tutorial topic?

  • Yes
  • No

0 voters

#51

how to make a DRAWING PAD

Drawing pads are cool! Here’s a tutorial on how to make one! (Without HSB, and RGB)
What will you use in this tutorial?

  • values
  • draw a trail blocks
  • more values lol
  • probably the copy and paste feature

first: the pen

first

Drag out a text object. This will be the pen.
If you want a cursor on your pen, add the symbol you want as the cursor as the text. If you don’t want a cursor, leave the text blank.
image
Now, time to add some code.
In the Pen object, drag out a When (iPad/iPhone) is Pressed block. Inside the When block add a Draw A Trail block. Set the color to any one you like. For now let’s set the width to 10. We’ll change that later.


It draws, but oh no— when you tap the screen, it leaves a trail between your drawing and the place you tapped!

Let’s fix that. How?
Add a When (iPad/iPhone) is Tapped rule, and inside, add a Set Position to (Last Touch X) (Last Touch Y).

Great! Fixed!


second: the width

second

step 1

So let’s make some width controls, so we can change the pen width.
Drag out three text objects and arrange them horizontally or vertically, anywhere in the editor.
The two on the outside should be set text to an arrow or a greater/lesser sign.
The one in the middle will show to the width the pen is. (In numbers.) Name that one in the middle whatever you want.

step 2

Now let’s make some code for that middle object, so it shows the width.
Drag out a When Game Starts block, and inside that add a repeat forever. Inside the repeat forever, add a set text block.
Now let’s code it so the object sets text to the width. How will we do that?

Tap the number icon on the keyboard to switch to the numbers section.

Create a new value, “Width,” and select that to put in the Set a Text block.

You can also add a Set (Width) to (10) block so that the width starts at 10.


Now time for the controls for the width.
They’ve got really similar code.

step 3

For one arrow, drag out a When Self Is Pressed or a When Self Is Tapped and inside that rule, add an Increase (Width) by 1 block.


For the other arrow, drag out a When Self Is Pressed or a When Self Is Tapped and inside that rule, add an Increase (Width) by -1 block. I know it says “increase” but because the block says “-1” it will actually decrease the width.

the code

step 4

Now the arrows increase the width, but the pen is still drawing with a width of 10, no matter how high or low the width is!
Because we didn’t change the width in the Draw A Trail block (in the pen rule) to the width value. Let’s do that.

the code

Whew done with the width. Time to add the colors.


third: the colors

third

So a drawing pad needs colors, right? Of course! Now let’s add some.
In this tutorial, I’m only going to show the code for one or two colors, but you just have to repeat the code for each additional color, with some changes to the color value.

Now we’re going to have to change the pen’s code again, in this step. We’ll do that later.

Now for the first color, drag out a circle. Or really any shape or symbol.
Add this code below to it. You’ll need to create a new value, Color.


For the second color, just change the Set Value (Color) to 1 to Set Value (Color) to 2, and make the object become a different color.
For the third color, just change the Set Value (Color) to 1 to Set Value (Color) to 3, and make the object become a different color.
And just repeat that for each color.

Now, to get the pen to draw these colors…

So the rule of code that makes the pen draw is currently a When Pressed, but let’s change that code to this.


See those rules of code? Repeat them for each additional color, changing the trail color, and the When (Color) = 2 to When (Color) = 3 for the third color, When (Color) = 4 for the fourth color, and so on.

There you have it, your drawing pad.


Here’s the project I made as I made the tutorial.


This is 100% free to use.


was this helpful?

  • Yes
  • Sorta
  • No

0 voters

If you have any questions feel free to ask!

2 Likes
#52

Clones are confusing concepts in Hopscotch
Creating a clone just uses the block
image

You can create them using the: When Game Starts block or the less then block which makes clones almost instantly
image

To control the clones separately the block use an equal to block and do what you want that clone to do like so
image

This example shows
Create 49 clones
When Clone Index = 5, then turn 1 degrees

The clone is going to turn forever if we don’t put a
repeat forever wait 1 millisecond
image
Go to Clone Test

If you need more help comment what you need help on
Go to Clone Test

3 Likes
#53

Cool tutorial!

Except it’s prob going to get merged with another tutorial topic.

3 Likes
#54

Nice tutorial! First

2 Likes
#55

I would like to see all of those choices.
(Btw this topic is really cool and helpful)

#56

That title is much better!

2 Likes
#57

Why are so many topics getting merged onto this

1 Like
#58

Because like 10 were made I guess lol

1 Like
#59

How To Use CLONE INDEX

Okay, first, You maybe already have noticed that an objects clones do The same things, that is why we have Clone Index, to make clones do different things!

Step 1. Make a few clones on an object⬇️

Step 2. Open a “When Object is cloned” tab. Pick a “Check Once If” block. In the check once if, do like this⬇️

Step 2. Fill The block with whatever You want, if you wondered why we picked “Check Once If, Clone index=2,”(picture above) and not just 1, The first one is The original object, so make sure to do that when you use this.

I filled The “Check Once If” block with this⬇️

Step 3. Make a new “Check Once If” tab, but with Clone Index=3⬇️, also fill this with whatever you want.

Step 4. If you tap play, The clones should do different things, My clones will move different ways, and change colours⬇️, (The black one is The Original Object, you can make it invisible if you want in The “Game Starts” tab, or change it to an invisible text object).

If it looks like this (or how you coded this, this was just My example), CONGRATULATIONS! You did it!

Here is an example of using Clone Index⬇️

4 Likes
#60

Tell em clone index is for determining the clone’s number from the org. object

1 Like
#61

Sine and Cosine won! I am working on that one now!

1 Like
#62

Sine and Cosine tutorial
How to use
You know the roatate block right, you need this to use sine and cosine correctly!


Press the turn block, then select any number. (Recommendation: 2)
Once you have plopped down your turn block, select repeat forever (In control flow) and put the turn into there.
Next, go to the set position block, select X, and select Cosine.

Once you have selected cosine, go to the box after cos, and find Roatation.

Click on it. It should say self rotation, which is fine. Once you have done it, you are done with Cosine! Play and check it out.
Now time for sine

Go inside Y this time, select Sine
Select the rotation block

And you are done! When you press play, your object should move in a circle. If you did it correctly, your code should look like this!

Feel free to mess around with sine and cosine!
Did you find this helpful?

  • Yes
  • No

0 voters

Vote on the next tutorial! (Poll below)

3 Likes
ChickenProductions7’s coding school
#64

Nice tutorial! It is more of a “How to make a fast circle” than “How to use sine and cosine”, though.

2 Likes