Why make games on Scratch?
As we mention in our Scratch coding article, Scratch is one of the best platforms for all ages to build coding projects online. The platform is easily accessible for android tablets, and most desktop OS. It's also a great starting point for new coders ages 8+ to begin learning coding fundamentals through block-based coding.
The Scratch programming language is incredibly versatile — Scratch blocks can be used for anything from making animations to telling interactive stories. The most popular use of Scratch, however, is to program video games.
If you visit the Scratch community (https://scratch.mit.edu), you'll find an incredible collection of video games constantly being updated and added to. The Scratch programming language is perfect for fun games because it supports player input, and gives players nearly unlimited control over its code.
Totally inspired, but not sure where to start? Don't fret!
We'll show both beginners and experienced Scratchers how to make any simple game on Scratch, step-by-step. You can follow along with the new game that we make here, or even use these basic steps to create your own game.
Now, let’s get started!
Game Tutorial: Table of Contents
|Intro: What counts as a game?|
|Step 1. Start with a Plan||
|Step 2. Set up your main character||
|Step 3. Pick out a backdrop|
|Step 4. Add an objective||
|Step 5. Add more features!||
|Great job! Now check out some more advanced Scratch games.|
|Need help or want to learn more?|
What Counts as a Game?
Before we can make a game, we have to first understand what exactly a game is.
Games are one of the most popular forms of entertainment in use today. There’s a ton of different kinds of interactive games that are played for fun, educational purposes, or both. But when you boil it down, all games share two core requirements.
For something to be considered a game, these two requirements must be met:
- The player must have control over something.
- The player must have an objective to complete.
If something meets these two requirements, it's a game!
When people think of games, they typically think of popular, complicated video games or computer games like Minecraft or Fortnite. In reality, games don’t have to be so large in scope. They can also be something as simple as Rock, Paper, Scissors or Tic-Tac-Toe.
- In Fortnite, players have control of their character’s movement and actions. The objective is to be the last person alive!
- In Tic-Tac-Toe, each player has control over where they place their Xs or Os. The objective is to connect 3 of these in a row before the other player does!
Even though these two games are totally different, they share the same core functions. By creating a project that meets these two requirements, you can easily create your own game!
The best way to start this game development process is to begin planning things out.
Step 1: Start with a Plan
Making a plan is the first and most important step towards making a game. This can also be thought of as your game design.
This step may seem trivial, but it gives your project direction. People who skip this step and start coding without a plan can easily lose sight of their goal, and often end up abandoning their game before it's complete.
But don't worry — making a plan can be fun!
Planning is a great chance to practice your creativity and come up with a cool project idea. Even though it seems daunting at first, following three simple guidelines will make the process easy.
To start planning a game in Scratch, you need to complete these three steps:
- Pick a theme
- Figure out what the player will do
- Pick an objective that the player has to complete
Once you figure out these three things, the rest of the game will follow naturally. You don’t have to figure them out in any specific order, though! It’s probably easiest to pick out a theme, then work on the other two. But you should focus on the one which inspires you the most.
While you’re planning out your game, you should try your best to keep it simple!
For your first game, don’t worry if it’s not everything you wanted it to be. Choose something that you will be able to make in an hour or two, as this will be much more gratifying. Making complicated games like the ones on the Scratch Homepage takes a lot of knowledge and hard work.
Just focus on completing something, and you'll soon be on your way to greater things!
Step 1a: Figure Out a Visual Theme
One of the most important aspects of a game is its visual appearance.
This can be independent of how the game actually functions, but it shapes the player’s experience quite a bit. Your game’s visual theme is a combination of its setting and characters.
For example, a medieval themed game would be set in an ancient castle, with knights and horses. A wild west game would be set in the desert, with cowboys and a saloon!
Picking a theme can often be the easiest part of making a game, as it follows naturally once you come up with an idea you like. To pick out a theme, try to think of one thing that you want to put in your game.
Here are a few example ideas:
- I want to make a game that takes place underwater.
- I want to make a game with lots of food in it.
- I want to make a game with astronauts and aliens.
You can easily expand any of these ideas to become a complete visual theme with both a setting and characters.
Step 1b: Figure Out the Core Mechanics
The next step in making a plan is to figure out what people will do in your game. To do this, you must:
- First, figure out how players will control your game.
- Next, you can figure out what the objective of your game will be.
While you’re thinking about what players will do in your game, try your best to keep simplicity in mind. Many of the most popular games are just too complicated for beginners to make.
Specifically, try to avoid platformers and fighting games. Advanced games like platform games involve recreating complex concepts like physics and gravity — we’ll discuss how to make them in future advanced Scratch guides.
That said, simple games are still lots of fun to play! If you’re having trouble coming up with game ideas, here's a few suggestions:
Play this simple collecting game, Hungry Hippo! Help the hippo eat, or collect, the food.
Check out this simple dodging game, Cake Chaser! Help the cake escape from the hungry beetle.
This is a simple question game, called Number Guesser. Guess what number Giga is thinking of to win!
Step 1c: Bring the Game Plan Together
In this article, we are going to make a collecting game. This is what I've thought of so far for my plan.
- Theme: The game will be about mermaids, and take place underwater
- Control: The player will control the movement of a character
- Objective: The objective is to move the character around, and collect as many items as you can!
Your plan doesn’t have to be super detailed. All I know about my game so far is that I want to move a character around and collect items. And that’s already enough to get started!
Now it’s time to actually start writing code. To create a Scratch project, go to the Scratch website and click “Create.” This will take you to a brand new, untitled Scratch project. The only thing you should see is a cat in the middle of the stage.
Step 2: Set Up Your Main Character
Step 2a: Create a Sprite
To get started, we will need to create a “Sprite” for our main character. In Scratch projects, characters and objects are represented by Sprites.
These sprites are images, and appear in the main area where your game takes place (in the top right, called the Stage). Sprites can move around and execute code that we give them, which allows us to create some truly awesome projects!
Right now, the only sprite that our game contains is the Scratch Cat, included in every project by default. To create a new sprite for your main character, click the button labeled “Choose a Sprite” in the bottom right corner of the screen.
Now, select your main character from this menu. You can choose from a list of premade sprites, or customize your game and paint new sprites yourself in the costumes tab or paint editor. You can even upload a picture of yourself if you want to!
For our game, we will use a mermaid as our first sprite. This is one of the default sprites in the menu, so anyone that wants to can follow along!
After creating a sprite, you should see it in the center of the Stage. The cat will be there as well — unless you want him in your game too, you can delete him if you right-click the trash can icon on his sprite.
Step 2b: Program your Character
Now that we’ve created a new sprite, it’s time to bring it to life! Since this sprite is going to be the main character of our game, let’s write code to let the player control it.
The code you write on a controllable sprite will allow the sprite to move when the player presses buttons. If you’re making a question game, the code you write can ask the user questions instead. In general, the code on your main sprite should implement the “Control” section of your plan.
For our game, we want our mermaid to be able to move around. She will move left / right / up / down when we press the left / right / up / down arrow keys.
▶ Code it: Read our Scratch Sprite Movement for Beginners tutorial to learn how to program this code.
Check out what this Scratch movement code gives us below by clicking the green flag!
Now we've already completed an important part of our game. The player can now control a sprite, which is one-third of our plan!
Step 3: Pick out a backdrop
Before moving on to add an objective, let’s first solidify our theme by adding a backdrop. While backdrops are not necessary to complete a game, they certainly add quite a bit of character.
You could make a working game without them, but then your game would simply take place on a white screen! Choosing a fun backdrop helps communicate the theme of your game, and makes your game more engaging and immersive.
To pick out a backdrop, simply click the blue button to the right of the “New Sprite” button. This will take you to a backdrop menu, where you can select any backdrop you want.
You can also draw your own backdrops, or upload any picture you want from your computer! To try out these other options, click the corresponding buttons in the drop-down menu.
No matter what option you choose, try to coordinate your character and backdrop. For example, if your main character is a knight, you could use a castle as your backdrop. This will communicate the theme of your game to the player.
Since our main character is a mermaid, our game will take place underwater. Beautiful!
Step 4: Add an Objective
Now, let’s add in objective to our game. To do this, we can create a new sprite which will interact with our main character.
Step 4a: Pick a Sprite
Based off of the plan you made earlier, you should already have a rough idea of what you want your objective to be. Different types of games can have vastly different types of objectives.
Here are the objectives for the games we mentioned earlier:
- Collecting Game: Objects you’re supposed to collect
- Dodging Game: Enemies you’re supposed to avoid
- Question Game: Questions you’re supposed to answer
You should select your objective’s sprite based on the kind of game you want to make. For example, a Question game could have a wise Sphinx which asks questions to the player. A dodging game could have a spooky ghost which chases the player around!
For our collecting game, the mermaid will need to collect pearls. When she collects a pearl, another one will appear in a random spot! Our score will increase by one for every pearl we collect.
This is the sprite which we’re using for the pearl. Since the Scratch sprite library does not include any pearl sprites, we made our own using the sprite editor.
Try to paint a new sprite for this step, or alternatively use a picture from your computer!
Step 4b: Write the code for your objective
Whenever the mermaid touches a pearl, we want another to appear in a random position on the screen. This can be accomplished easily by using the blue
go to random position block.
Here is some simple code to make this happen:
Even though there’s only a few blocks of code here, they can still be difficult to understand. Let’s walk through what this code does, step by step:
- When you click the green flag, the game begins.
- After the green flag is clicked, the pearl will check to see if it is
- If it is, then it will go to a
- Steps 2 and 3 will repeat
forever block on the outside is what is known as a loop. This loop repeatedly runs any code that you put inside of it until the game stops.
This ensures that whenever the mermaid touches the pearl, the pearl will react. Without it, the pearl would only check this condition once at the start of the game.
Awesome! Now let's play our completed game below:
Try moving the mermaid to the pearl. When it touches the pearl, the above code will run, and the pearl will go to a random spot on the screen. This is exactly what we want!
Explore: What other games can we code?
Other types of games will feature different objectives.
Dodging games contain enemies which you’re supposed to avoid. The code for an enemy like this is pretty similar to the code we just wrote above. We need code to check if the player touches the enemy.
If the player does touch the enemy, then something bad will happen. An easy way to make enemies is to have the game end if you touch them. However, you can program anything to happen if they touch — get creative!
Question games are different from collecting and dodging games. Instead of having the player move and touch a sprite, they have a sprite which asks the player questions.
If they get the questions correct, they win. To set up a sprite which does this, you can use the light blue
Ask ___ and wait blocks in Scratch. You can then use an
if statement to check if the answer is correct!
Step 5. Add more extra features!
Scratch Game Extensions
Now that you have a controllable character and a working objective, your project meets all of the basic requirements of a game!
If you’ve made it this far, you can now say that you have created your own video game. Great job! Even though your project counts as a game, you can still improve it to make it more fun to play.
In order to extend your game to be more complex, like this Ocean Cleanup game, try to add in components which fit under these categories:
- Extra goals
- Extra rules
- Extra challenge
- Extra interaction
Here are some examples of components that fall under these categories:
|Score||Score in a game tracks how well the player is doing. This could be how many objects they’ve collected or how long they’ve survived. You can even add in a high score to try and beat!|
|Timer||A timer keeps track of how long the player has left. You can only play the game until the timer runs out! This makes it extra challenging to score well in your game.|
|Lives||Players lose lives by messing up somehow in the game. If they run out of lives, it’s game over!|
|More objectives||No matter what kind of game you make, you can add in more objectives in order to have more interactions and rules. In collecting games, you can add in more objectives to collect. For example, in our game we can add in multiple pearls.
Additionally, objectives can take many different shapes! Creating more complex mechanics for your objectives can make your game quite a bit more fun to play.
Visit tutorials like how to make a timer in Scratch to learn how to add some of these features. The only limit to these kinds of extensions is your imagination!
Finally, there are several nonessential additions we can make that'll make our game more fun to play. These cosmetic changes can be added to any project, and won’t change anything about how players interact with your game. They'll just make your game cooler!
Try to implement these additions on your own:
- Add a sound effect when you collect an item
- Add in music while you play the game
- Costume changes
- Add more sprites
Check out our Mermaid game with some of these additional features:
The easiest addition you can make to any game is sound. By using Scratch’s sound blocks, we can add all kinds of noises to our game.
One more addition you can make to any game is costume changes. We can instruct our sprite to “switch costumes,” which allows us to add in animations for things like walking or flying. You can also use this in many advanced ways to create entire projects!
You can also increase immersion by adding other sprites — avoid clutter though!
More Advanced Games
Check out these examples of some more advanced games you can make! In more tutorials, we'll talk more about how you can add these complex features into your games.
- Using Physics: This collecting game uses simple “physics” - instead of stationary objects, cheesy puffs are constantly falling from the sky!
- Implementing a timer and score: This dodging game puts the player in control of an umbrella. The objective is to use this umbrella to keep a baby chick dry - try to keep the “Missed” counter as low as possible!
- Adding lives and advanced mechanics: This advanced game combines many different mechanics. The player controls a character with the arrow keys, and the objective is to explore the cave to collect treasure while answering questions correctly.
Great job! You're now an awesome Scratch game designer.
We hope you enjoyed this step-by-step tutorial to build a basic game in Scratch! Visit the Scratch community to showcase your project, or keep exploring what other cool games people are building.
To keep practicing with other Scratch projects, check out more of our Scratch tutorials and step-by-step coding video tutorials on our blog.
Need help or want to learn more?
Juni Learning offers project-based Scratch Coding Classes for kids 8-11 to get started with coding. Our Scratch curriculum prepares young programmers with full mastery of the Scratch environment, and prepares them to advance into coding in more advanced, text-based languages like Python.
- Game Superstar (Scratch Level 1): introduces computer science fundamentals such and teaches students how to build and design their own Scratch games.
- Game Master (Scratch Level 2): covers more complex concepts like nested loops, complex conditionals, cloning and more in preparation for learning more advanced coding languages.
Read more about our online coding classes for kids, or contact our Admission Team to learn which course is best for your student’s coding journey. You can also read more about how we use Scratch to teach coding.