Scratch is one of the best block-based programming languages for beginners.
With Scratch, you can create your own coding projects – from coding interactive stories to creative animation!
The best part is, with Scratch, you can even code your own video game!
In this blog post, you will find step-by-step instructions on how to make a game on Scratch.
Before even getting started with making a game on Scratch, it is helpful to brainstorm ideas. Ask yourself questions like:
Maybe you will decide to create a choose your own adventure game.
Maybe you will make a side-scrolling game, where your character navigates different obstacles.
Game Credit: Scratch Run v1.4 – #games by chipm0nk. Play this game: https://scratch.mit.edu/projects/540973055/
Or, maybe you will create a dodging game, like the one featured later in this blog post.
This is the dodging game our team at Inspirit AI created!
Once you have brainstormed ideas, it is time to write out your plan.
Grab a piece of paper and a pencil, and write out your game plan! You can even add drawings to level up your game design.
Let’s take a look at an example!
Our robot friend Pip is coding their own game in Scratch. Pip put together the following plan:
Now, you can begin making your game in Scratch. Create a new project and check out the Sprite menu.
In most video games, there is a main character. In Scratch, we call characters and objects “Sprites.”
Right now, your program only has one Sprite, the Scratch cat! To add new Sprites, click on the “Choose a Sprite” button.
Now, you can select a main character from this menu. Use the search bar to look up different characters!
In our car game, we uploaded our own Sprite called “My Car.”
Next, you’ll need to write your code for your main character. This step is important so that the player can actually control the Sprite.
If you are making a dodging game, you will likely want to use the Sensing blocks to program your main character to move left, right, up, and down with the left, right, up, and down arrow keys.
Here is a simplified version of what your code might look like!
You will most likely need to keep adding to your main character’s code as you build out your game.
For now, let’s take a look at how to add a backdrop to your game in Scratch.
Near the Sprite menu, you can choose a backdrop to add! Click the button that says “Choose a backdrop” to get started.
Next, you can choose from tons of different backgrounds, just like how you selected a Sprite!
Our car game takes place on a road – which fits perfectly with the theme we chose!
In Step 2, you came up with a plan, which included your game’s objective.
Based on the objective you picked, you will want to start adding goals and obstacles to your game.
In a dodging game (like our car game), you would need to add objects, or Sprites, for your main character to dodge.
You’ll need to write code for each of these obstacles.
You can also add goals, like coins, to collect throughout the game. These will also be Sprites that you can program.
This step will most likely take the longest, so practice perseverance and patience as you program!
Let’s take a look at an example of programming an obstacle for a dodging game…
In our car game, a red truck is an obstacle that we included. The objective is for our main character Sprite, “My Car,” to dodge the obstacle sprite, “Red Truck.”
First, we need to write code for our red truck. The code below programs our red truck to appear randomly and move across the game screen.
Here is an example of what part of our code might look like!
Next, we’ll want to make sure that the game ends if our main character Sprite, “My Car,” crashes into “Red Truck.” The best way to do this is to utilize the touching block.
In our game, we used a mix of Sensing, Control, and Define blocks to make this happen.
In the image above, you’ll see a snippet of what this looks like!
Creating a game in Scratch can take a lot of time, but it’s so much fun to code along the way. Be creative and persevere!
Once you’re done, you can play your game and share it with friends.
Inspirit AI offers online coding classes for students of all ages, developed by Stanford and MIT graduates. Apply to our programs to learn how to create your own video games on Scratch!
Learn more about our elementary school offerings here.
Learn more about our middle school offerings here.
Thank you for reading this blog post about how to make a game on Scratch! Check out our other blog posts here.
Meet our team here.