Hey, Hopscotchers! Today I’ll be showing you how to make an endless runner game!
First, we need to make the character. Your character can be anything, but let’s just use the circle shape for now.
There is more than one way to make your character jump, here are two of them:
Method 1: Not As Realistic
I used this method for my first endless runner game. It can be considered easier to make than the other method I will show in this tutorial, but it doesn’t look quite as realistic. For this method, we need:
- 2 Change Y By Blocks
- 1 Wait Block (optional)
First, we need to add a new rule, when iPad is tapped. You can also make the rule when a button is tapped.
Now, we add the Change Y By blocks. In the first one, type in any number you want, and type the negative of that in the other one. I’ll just go with 200 and -200.
Method 2: More Realistic
I used this method for my Easter game. Although it may be considered harder than the other method shown in this tutorial, it looks slightly more realistic. For this method, we need:
- 3 Set Value Blocks
- 1 Increase Value Block
- 1 Repeat Forever Block
- 1 Change Y Block
- 1 Check Once If Block
- 2 Values
First, we need to add a new rule, when the play button is tapped. If you don’t want to use the Repeat Forever block, you can use when 7 = 7.
Now, if you used the when the play button is tapped rule, you will need to add a Repeat Forever block. Inside this Repeat Forever block, you will need to place a Increase Value block and a Change Y block.
Now we need to make a new value. Let’s call it . Now, copy this code:
After copying this code, add a new rule :
Now, choose how high you want your character to bounce when it hits the ground. After that, add another new value;let’s call it “Touched Ground?”
Finally, we need to make it possible to jump. Add a new rule, when the iPad is tapped. You can also make the rule when a button is tapped. Now, choose how high you want your character to jump.
To complete our endless runner game, we will need to add obstacles. Let’s use the triangle shape.
Now, we need to make it repeatedly fly in from the right side of the screen. Copy this code:
Finally, add a new rule to your character:
Now you’re done! I encourage you to play around with the code, maybe add a background. I hope you enjoyed my little tutorial!
Here’s a link to an example of this: https://c.gethopscotch.com/p/xwa84xlf4