When kids develop their own games in Scratch, they can add different levels to make their game more fun and engaging. In this tutorial, I’ll show you how to create a game with levels in Scratch based on points.
Leveling up in a game is one of the most satisfying feelings for any player. It’s a sense of achievement and accomplishment that makes playing games so addictive!
Popular games like Super Mario, Legend of Zelda, or Final Fantasy all use levels to challenge players and present new skills, worlds, and opponents.
Kids can also learn Scratch coding in our top-rated coding classes for kids. They’ll code games with a live instructor and build projects in every class.
What is a game level in Scratch?
A game level is part of a game that players must complete before advancing. Many games have progressive levels where players must complete every level to finish the game.
Anything can happen in a new level!
A new level can signal changes like increased difficulty, new challenges, location, characters, or gameplay. Levels can be represented in maps, stages, missions, courses, or rounds.
Leveling up in a game can depend on different factors too. Players may level up based on points, experience, goals, etc.
Some games use level as a ranking method. Players or characters have individual levels, like Pokemon cards and Minecraft. As the player gains experience, they level up, acquiring new abilities and access to new content.
Why add levels to your Scratch game?
Levels are a common feature in all types of computer, mobile, and online games. Some games even have hundreds or unlimited levels for players to conquer.
Game levels motivate players to keep playing. Adding levels to a game is a way to challenge players, give them a goal to work towards, and explain how to progress in the game.
For game developers, adding levels helps control the gameplay and design. Levels can also carry forward the story or narrative of the game, immersing the players in the storyline.
How do you add levels to a Scratch game?
There are many different ways to add levels in Scratch. You first need to decide on the game logic.
How will players advance levels?
Decide which factors will allow players to advance, such as time, points, actions, etc. In the Dragon Jam game, players advance by collecting a specific amount of strawberries.
What happens when a player advances levels?
Decide what features will change at each level. This can include the location, characters, goals, etc. In our tutorial game, a new level signals a change in the location and the goal to reach the next level.
Once you’ve decided on the game logic for your levels, you can write the code to execute it.
Steps to Make a Game on Scratch with Levels
Complete this Scratch tutorial for kids to build a game with levels.
Play and remix the Dragon Jam game now.
What you need:
Scratch account: Create a free Scratch account
No coding experience is necessary for this Scratch tutorial. Beginner-friendly for kids ages 8 and up. Give it a try!
Step 1: Create a new Scratch project
Get started by creating a new project in Scratch.
- Visit https://scratch.mit.edu/
- Login to your account and click on the “Create” button.
A new project will open up and you will see the Scratch interface.
Now, we can code your game!
Hint: You can also remix this project and others to see the code.
Step 2 Add Sprites
We need a player (dragon) sprite and a loot (strawberries) sprite for our game.
- Delete the cat sprite first. Click on the cat sprite and the trash can icon.
- Click on the “Choose a Sprite” button and select “dragon”. Resize it to 30.
- Click on the “Choose a Sprite” button and select “jar”. Resize it to 30.
Your player and your loot are all set! Next, add a backdrop.
Hint: Choose or paint your own sprites to create a different theme for your project.
Step 3 Add a backdrop
Let’s start by adding one backdrop, when we switch levels we can add additional backdrops to each level.
- Click the “Choose a Backdrop” icon and add the “Castle2” backdrop
You should now see your game background in the preview.
Hint: Choose or paint your own backdrop to match the theme of your project.
Step 4 Move the Dragon
Your player, the dragon, needs to move from side to side to catch the strawberries.
Let’s add code to move the dragon right and left using arrow keys. We will use the “Events” blocks.
- Click on the dragon sprite to add code to it
- Add the “When space key pressed” block and change the dropdown to “right arrow”
- Underneath that, add a “Change x by” block and use 15 to move right
- Add the “When space key pressed” block again and change the dropdown to “left arrow”
- Underneath that, add a “Change x by” block and use -15 to move left
Test it out, your dragon should move when you press the arrow keys!
Hint: Change the 15 and -15 values to move your player faster or slower.
Step 5 Make Falling Strawberries
Now, let’s make it rain strawberries. We need a lot of strawberries, so we will be making clones of the one strawberry sprite.
- Click on the strawberry sprite to add code to it
- Add a “When green flag clicked” block that will start our code
- Add “Hide” block to hide the original sprite
- Add a “Forever” loop
- Inside the loop, use the control blocks to “Wait 1 second” and “Create a clone of myself”
Each new clone will fall towards the dragon from a random position at the top of the game screen.
- Since the x position of the sprite changes every time, first make a new variable called x position to store it.
- Uncheck the variable so it doesn’t show in your game screen.
- Add a “When I start as a clone” block
- Add “Show” block so we can see the clone
- Go to x and y block, use the x position variable and 150 for the position
- Use a “Glide” block to bring the strawberry down to a y position of -150
- Delete the clone once it is off the screen
Click the green flag to watch your strawberries falling from the sky.
Hint: Change the number of seconds in Glide to make your strawberries fall faster or slower.
Step 6 Add Score
Our player levels up based on the score, so we need to calculate a score in our code.
- The score changes, so make a new variable called “score” to store it.
- When a new game starts the score should be 0. Under “When green flag is clicked” add a “Set score to 0” block.
Next, increase the score every time the sprites touch.
- Add “When I start as a clone” block
- Then, add a “Wait until” block and use the sensing block for “touching”. Change the dropdown to “Dragon” or your player sprite.
- Add a “Change by” block from variables to change the score variable by 1.
- Finally, add a “Delete this clone” block to make the strawberry disappear
Move your dragon around to collect the strawberries and watch as the score increases!
Hint: Try adding different loot with higher or lower scores to make the game more interesting.
Step 7 Add Levels
Now, let’s make the game more challenging by adding levels. In each level, the player needs to collect more strawberries (or more points) to advance. So, think about the game logic.
How many strawberries does the player need to advance in each level?
Level 1 Score 3 points to advance (total of 3 points)
Level 2 Score 5 points to advance (total of 8 points)
Level 3 Score 7 points to advance (total of 15 points)
Level 4 Score 10 points to advance (total of 25 points)
Level 5 Win!
What happens after the player advances a level? The backdrop will change.
You’ve already added the backdrop for level 1. We will add 4 more backdrops for the other levels.
- Click the “Choose a Backdrop” icon and add another backdrop.
- Repeat this 4 times with a different image each time. We are using the Savanna, Underwater 1, Mountain, and Metro backdrops
- You can see all of the backdrops you chose in the “Backdrops” tab. If you have a default white background, click the trash can icon to delete it.
The location, or background, changes when players pass a level. We can write that in code like this:
- First, click on the Dragon sprite to add code to it
- The level changes, so make a new variable called “level” to store it.
- Add a “When green flag is clicked” and a “Set level to 1” block. When a new game starts the level will begin at 1.
- Use “Switch backdrop to” and choose the backdrop you want for the first level.
- Add a “forever” loop
- Inside the loop, we will add an if statement for each change in level. For example, if the score is greater than 2, set the level to 2 and switch the backdrop to Savanna.
- Copy the If statement and add the change in score, level, and backdrop for each level you have.
Press the green flag to play! You should see the levels increasing and the backdrop changing.
Hint: Customize your levels by changing the scores or backgrounds.
Step 8 Win Logic
Players can collect strawberries and level up, but they don’t know when they win or lose. Let’s display a message to the player when they win.
On the Dragon sprite, we will add code inside the level 5 if statement.
- Add a “Broadcast” block and change the message to “you win”
- Add a “Stop all” block to end the game
Create a message to the player that they win.
- Click on the cat icon, select “Paint”
- Select the rectangle option to draw a white rectangle
- Then, select the text option and type “You Win” in red on top of the rectangle
- Right-click on the sprite to name it “You Win”
We only want to show the “you win” sprite when the message is received.
- On the “you win” sprite, add a “When Green flag is clicked” block and a “hide” block
- Add a “When a receive” block and change the message to “you win”
- Add a “show” block and “stop all” to end the game.
You should now see the win message when you reach a score of 25!
Hint: Test your win message by setting the score to start at 24 instead of 1.
Step 9 Lose Logic
Now, display a message to the player when they lose.
On the strawberry, send a losing message when a strawberry reaches the floor.
- Under the “glide” block, add a “forever” loop
- Inside the loop, add an “If” statement with an operator for y position is less than -149.
- Add “broadcast” and create a new message called “game over”
- After the loop, add “delete this clone” block.
Create a message to the player that they lost,
- Right-click on the “You Win” sprite and duplicate
- Go to the Costumes tab and edit the text to “Game Over”
- Right-click on the sprite to rename it “game over”
We only want to show the “game over” sprite when the message is received. Since you duplicated a sprite, the same code will also be on this sprite.
- Update the “when I receive” block and change the message to “game over”
All of your game logic is complete! Play the Dragon Jam game.
Click the green flag to play your game. If you want to let other people see your project and remix it, click the “Share” button at the top.
You can “see inside” our completed Dragon Jam to get a peek at the full Scratch code.
Download Free Printable Scratch Coding Tutorials PDF
Get the Rocketship Landing game and Flying Space Cat Scratch tutorials in a printable format.
More Scratch Tutorials for Kids
Try making another game with levels. Pick one of these fun Scratch game tutorials and add levels.
- Valentine’s Day Card Scratch Tutorial
- Holidays Advent Calendar Scratch Tutorial
- Halloween Candy Collector Game Scratch Tutorial
- Flying Space Cat Scratch Tutorial
- How to Make Flappy Bird on Scratch
- How To Make a Game on Scratch
Learn How to Make Games with Levels in Scratch
Coding games in Scratch is a great way for kids to learn about programming fundamentals and game development.
If your child wants to dive deeper into Scratch, join our top-rated Scratch classes for kids. Students in our elementary school coding program learn to code with Scratch and advance to other languages like HTML/CSS, JavaScript, and Python. Learn from live, expert instructors while building fun projects and games that your child personalize and share.
Enroll today to start coding in Scratch!