The Basics of Advanced Coding on Hopscotch

The Basics of Advanced Coding!

Together we will learn the basics of hopscotch (2021 style) together!
If you are new or don’t believe your the best at coding don’t worry, this is the topic for you!


what we will be learning!

  • How to use the when blocks

  • How to use variables

  • Main reasons for bugs in games


how to use the when blocks!
When blocks can be tricky for new users on hopscotch but as I said, your in the perfect topic!
Let’s see an example -

When game starts
 Set: *example variable* to random 1 to 3
End

This code is telling the character to set the variable, example variable to random 1 to 3

When: *example variable* = 1
 Move forward: 10

In this, the code is telling the character to check when my variable equals 1 - you have to make this with other numbers like 2 and 3 to make it do something else every time it sets a variable to random 1 to 3


The important basics of variables
A variable is a value that can change over time the game. Like when using the increase blocks or the set block.
You can use set blocks or increase blocks to make a character spin from the corner! Another example awaits!

When game starts
Repeat: 200 times
 Increase: *example variable* by: 5

In this code, it is telling the character to increase the variable, example variable by 5, 200 times

When game starts
Repeat: 200 times
 Increase: *example variable* by: 5
 Turn: 5 degrees 
 Set position X: *example variable*Y:  *example variable*

This code is telling my character turn 5 degrees while increasing, example variable by 5, but it is setting its X position to the variable that we increased but it will also set its Y position to the same variable in X position so, X and Y position will be increasing by 5 200 times but since there are no numbers in X and Y it will start from the corner and increase its way up.


Main reasons for bugs in games
Bugs can be really stressful in games so I’m going to show you how to avoid them!

  • Wrong or missing variables
    Sometimes wrong variables can cause many problems in games because they all mean different things so one little mishap could cause all sorts of problems.

  • different interpretations
    People can sometimes use mis interpreted variables for set position blocks or X and Y blocks

  • nonsense equations
    Yep! When I mean nonsense equations I mean it - sometimes the equations don’t mean anything or it’s just nonsense! So it won’t do anything


Well that’s all that I got for all of you coders! Happy hopscotching!
@omtl

20 Likes

What a great tutorial!

5 Likes

Thanks! It took me a little while to type everything but I got there. :wink:

4 Likes

For me, the main reason for my bugs is due to a miscalculation on my part. The bigger a game is, the more chances it will have problems such as bugs and glitches. I can usually deal with the bugs, but sometimes I don’t catch them, or I forget to revert my changes when testing…

One glitch I had was “Menu Overlap” which is caused by tapping two or more buttons at the same time. Can be fixed by either disabling the other buttons when that happens, or use one variable to control which one gets activated…

4 Likes

Why my game mostly have bugs:

Blocks in the wrong order.
Using wrong variables.
Wrong calculations

3 Likes

Great tutorial for learning the basics of advanced coding!

4 Likes

Good tutorial

2 Likes

Oh my gosh thank you for making this

6 Likes

Thanks everyone!

3 Likes

I remember making a topic similar to this, but my topic was way more simple.

This is pretty good though, especially for people focused on the more advanced coders.

2 Likes

Ok! Thank you for letting me know!

2 Likes

I remember when I first started out in Hopscotch, and variables were very confusing to me. If a younger version of me would’ve read this topic, I would have been satisfied, leaving the topic knowing exactly how to use variables.

And even though this would probably be more helpful to beginners, this topic is still pretty descriptive. This may be something I refer to every once in a while.

1 Like