Adding Levels to Your Game with MakeCode Arcade
Arcade games are meant to be fun. Unfortunately, simple games can become boring quickly if the difficulty level doesn’t grow with the talent of the user.
Today, we’ll explore what it means to add “levels” to your game using MakeCode Arcade.
Start Simple
For the most part, you’re going to want to start with an easy to learn, quick to understand activity. Then, once a player succeeds in a basic task, you can increase difficulty. Depending on the game, you can change all kinds of gameplay elements to give players a new and more challenging experience.
Level Triggers
A level could change at any time, for any reason — but, some of the more useful level triggers are listed below:
- A certain amount of time has passed
- A certain number of enemies have been squashed
- A certain number of points/items have been collected
- A sprite has reached a special place/item
Implementing Triggers
Given the options listed above, here are some examples of how you might implement levels based on the chosen triggers:
Time Trigger
To trigger a level-change when a certain amount of time has passed, you’ll want to use a combination of the start countdown
and on countdown end
blocks.
Run an if/elseif/else statement inside of the on countdown end
block to check the new level value.
Enemy Trigger
To trigger a level-change when a certain number of enemies have been vanquished, you’ll want to keep track of the number of squashed enemies in a variable, then use an on destroyed sprite of kind Enemy
event to keep track of when the goal has been reached.
Points Trigger
To trigger a level-change when a certain number of points have been earned, check the score variable every time the score is increased. Usually, that means using the on sprite overlaps otherSprite
event.
You may try to do this inside of an on game update
event, but that will likely run several times for each score value, which could reset levels before you’re ready. To get around this, you’ll need to use an extra mechanic like flags or extra points for leveling-up.
To use items instead of points, you can still run your check inside of an on sprite overlaps otherSprite
event, but you’ll want to check for a special variable value (like we did with enemies) instead of using the score.
Key Trigger
To trigger a level-change when a sprite has reached a special place or item, you have a couple of different options:
- Use an if/elseif/else statement inside of a
sprite overlaps otherSprite
event to check which item was found and change the level based on its image.
- Use an if/elseif/else statement inside of a
sprite overlaps tile at location
event to change the level value when you get to a specific place, then change the level based on the new value.
- Let the item/place itself tell you what the next level should be, and change the level directly inside of the
sprite overlaps tile at location
event.
Level Suggestions
Once your game’s level has increased, you can make it harder to play using several mechanics:
- Add more (or quicker) enemies
- Shorten the amount of time they have to succeed
- Switch to a more difficult tilemap
- Require more points to get to the next checkpoint
- Require a larger combination of things before the next level-up
Conclusion
In the end, the way you change your game is entirely up to you.
If you have other ideas for leveling-up, please leave a comment below and share!