Tutorials for Code!


#1

This is a tutorial page for code!

Add a [details] with written code like this:

How to make When is Pressed for ___ Seconds:

When ____ is pressed
Increase value Press Time by 1
Wait 1000 milliseconds

When ___ is pressed
Check once if Press Time = X
(Code)
End

X is the number of seconds

You can add to the topic as this is a Notepad edit.
Rules:

  • Nothing Inappropriate
  • No deleting good tutorials
  • No spamming
    If you do delete something, I will know who did it.

Post below here:

How to make When is Pressed for ___ Seconds

When ____ is pressed
Increase value Press Time by 1
Wait 1000 milliseconds

When ___ is pressed
Check once if Press Time = X
(Code)
End

X is the number of seconds

How to make When is not pressed, credit to @SUPERSWAGGY

When is pressed:
Set value Press to 1
Wait 8 milliseconds
Set value Press to 0

When the play button is tapped:
Repeat forever
Check once if Press = 0
Wait 2 milliseconds
Check once if Press = 0
Wait 2 Milliseconds
Check once if Press = 0
(Add the code here)
End
End
End
End

How to make X and Y scrolling, requested by @Stradyvarious

Make 2 values called X and Y

Now on the object you want to scroll, for example; the walls put:
Repeat forever
Set position to X: X + (How far from the center of the screen you want) Y: Y + (How far from the center of the screen you want)
End

How to make this move:
Moving left is:
Increase value X by 1

Moving right is:
Increase value X by -1

Moving up is:
Increase value Y -1

Moving down is
Increase value Y by 1

Remember, you can change the 1's and -1's to whatever number.

My Tutorial For Getting On Featured, credit to @Bubbles4Ever929

Step 1: Come up with an idea
Coming up with an idea is critical to your results. It's the whole purpose of your game or just anything.

Step 1 1/2: Ask these questions
Is it original? Has someone made something similar? Will it be unique enough to deserve a feature? How complicated is it? Is it a challenge? Am I ready for a challenge? You'll know then if you should go through with the idea.

Step 2: Draw it out
It's simple. Grab some paper and plan plan plan. That plan will come to use!

Step 3: Make it.
This is also probably the most important. You can't just say ok make me all this stuff so I can take it and put in like 5 blocks of code. That's like cheating... Don't do that....

Step 4: Post.
Well now you gotta get it noticed! Make a topic or something (but make sure it's worth it) and then it'll get noticed. If nobody nominates it within 2 days nominate it yourself. Apologize though cause nominating yourself may seem rude.... (You know what I mean...)

Step 5: Wait
Now you wait. If you get likes on your posts about that project if the person who nominated you that post gets a lot of likes or if you nominated and that got a lot of likes then that is a good sign.

Step 6: Maybe... Just maybe...
That's my tutorial! It might work it might not but that's the best way to do it (I think atleast) Yeah that's all! I've never actually been featured or nominated yet... ;n;

How to make a smooth background

Set position to X: 0, Y: 0

Repeat times: 1024
Leave a trail colour (Colour 1) width 1
Set position to X Characters X pos + 1, Y: 0
End
Leave a trail colour (colour 2) width 1
Set position to X Characters X pos, Y: Height

How to make a score counter

Make a new value called Score
Make a new object, this will be the score display.

When the play button is tapped
Repeat forever
Set Text to Score
End

On you character:
When ____ bumps ____
Increse value Score by 1

How to make a passcode lock on your project, by @Stradyvarious

Where make a text like "."(full stop)
Code,
When game starts, wait 2 seconds
check if "START" = (9 digit number) or less digits
hide
else
forever , bring to front, grow 5000%

Drag the full stop to hide under the PLAY icon at the top right

To play the project, a user must set a value "START" to the 9 digit number(or less) in edit for the project to work.
https://c.gethopscotch.com/p/xx2xitu1y
Here is the link

Summary

Make a value "XV"

When game starts set XV to 0

Repeat forever,
Check if XV > 0
Increase XV by -.02

Repeat forever
Check if XV < 0
Increase XV by .02

When iPad is tapped,
Check if touch x is greater than Balls x position
Set XV to touch x - Balls x position divide 16
Else
Set XV to Balls x position - touch x divide 16

When balls x position is greater than 1023
Set XV to 0 - XV

When balls x position is less than 2
Set XV to 0 + XV

When game starts
Repeat forever,
Set Balls X position to XV, Set y position to ?(384)

Try this out to see if you like it.
Adjust the number "16" and make it higher or lower to suit yourself

If you want a bouncy gravity ball code check my project
Drag-Shoot or something similar on Hopscotch.
Can't provide a link at the moment


Put tutorials here!
#2

Wow! This is very helpful!


#3

Wow! This is really cool! It's going to come in handy for me really soon...


#4

I guess this is cool, but isn't this topic what the entire forum is about (+ questions)?


#5

Well, it is a way of having a lot of code tutorials in one topic.


#6

Well. I guess I should make one...

My Tutorial For Getting On Featured

Step 1: Come up with an idea
Coming up with an idea is critical to your results. It's the whole purpose of your game or just anything.

Step 1 1/2: Ask these questions
Is it original? Has someone made something similar? Will it be unique enough to deserve a feature? How complicated is it? Is it a challenge? Am I ready for a challenge? You'll know then if you should go through with the idea.

Step 2: Draw it out
It's simple. Grab some paper and plan plan plan. That plan will come to use!

Step 3: Make it.
This is also probably the most important. You can't just say ok make me all this stuff so I can take it and put in like 5 blocks of code. That's like cheating... Don't do that....

Step 4: Post.
Well now you gotta get it noticed! Make a topic or something (but make sure it's worth it) and then it'll get noticed. If nobody nominates it within 2 days nominate it yourself. Apologize though cause nominating yourself may seem rude.... (You know what I mean...)

Step 5: Wait
Now you wait. If you get likes on your posts about that project if the person who nominated you that post gets a lot of likes or if you nominated and that got a lot of likes then that is a good sign.

Step 6: Maybe... Just maybe...
That's my tutorial! It might work it might not but that's the best way to do it (I think atleast) Yeah that's all! I've never actually been featured or nominated yet... ;n;


#7

Smooth background tutorial added!


#8

Does anyone have tutorials that I could add?


#9

Anyone!


#10

How about a "Passcode Protect" to only allow users who know a 9 digit number to play a project/remix that isn't finished yet.

Like, Use an emoji like :black_medium_square:

At start,
Wait 2 seconds
Check once if value = (9 digit number)
Hide
Else
Repeat forever
Bring to front
Grow 5000 percent

(Drag the emoji to be under the play icon at the top right of the screen, so it can't be dragged out again)

Add a block to any text/ sprite,
In edit mode

At start set value to ?

The value must be set to a specific 9 digit number in edit mode or the project will glitch/stop/be hidden.
You can make a tutorial easier to read than this
@AHappyCoder

When projects complete and ready to publish just set the value to the 9 digits.


Collab anyone? 😄😄😄😄😄😄😄😄
#11

Can u make a PASSCODE tutorial.
Where make a text or use an emoji
Code,
When game starts, wait 2 seconds
check if "START" = (9 digit number) or less digits
hide
else
forever , bring to front, grow 5000%

Drag the text-emoji to hide under the PLAY icon at the top right

To play the project, a user must set a value "START" to the 9 digit number(or less) in edit for the project to work.
There are 1 billion possible number combinations from 0 to 999999999
@AHappyCoder


#13

Added :D


#14

This is now obsolete because of the new update that shows the code of any object in the editor.


#15

true...
D: