Learn how to make a video game in Scratch with this tutorial!

Table of contents

Summarise with:

There is no doubt that learning to code is an increasingly valuable skill. And one of the most accessible and enjoyable ways to get started in this world is through Scratch.

Scratch is an educational platform that enables users of all ages to create their own games and animations without needing any prior knowledge of coding.

Next, we’ll explain how to make a game in Scratch quickly and easily. We’ll also provide a step-by-step guide to creating a platform game, one of the most popular and exciting genres.

What is Scratch?

Scratch is a visual programming environment developed by the MIT Media Lab. It is designed to be intuitive and accessible, using drag-and-drop code blocks to create sequences of commands. This visual approach allows users to focus on the logic of programming without worrying about the complicated syntax of traditional programming languages.

Benefits of Scratch for creating games

Before explaining how to make a game in Scratch, it is important to point out that this is a tool which offers numerous benefits, particularly for those who are new to the world of programming:

  • Accessibility: Scratch is free and can be accessed from any web browser, making it widely available to everyone.
  • Intuitive interface: The Scratch interface is easy to use, with colour-coded code blocks representing different types of actions and controls.
  • Interactive learning: Users can see the results of their scripts instantly, which makes it easier to learn through experimentation.
  • Community and resources: Scratch has an active community and an extensive library of resources, tutorials and examples that can help users learn and improve their skills.
  • Skills development: Finally, it is also worth noting that Scratch helps to develop logical thinking, problem-solving and creativity skills, which are essential in programming and beyond.

Basic Programming Concepts in Scratch

In order to explain how to make a game in Scratch, it is essential first to go over some of the platform’s basic concepts. These concepts include the use of code blocks, sprites and backgrounds. Below, we will explain each of these elements and how they are used in game development.

Code blocks

In Scratch, programming is done using blocks of code that are dragged and dropped into the script area. These blocks are designed to fit together like pieces of a jigsaw puzzle, making it easy to create logical sequences of commands. It is also important to note that the code blocks are organised into categories according to their function:

  • Movement: They include blocks that allow you to move sprites on the screen, such as «move 10 steps» or «rotate 15 degrees».
  • Appearance: They allow you to change the appearance of sprites, such as «say [Hello] for 2 seconds» or «change costume to [costume2]».
  • Sound: They include blocks for playing sounds, such as «play sound [pop]» or «start sound [music]».
  • Events: These blocks run scripts in response to specific events, such as «when the green flag is clicked» or «when the [space] key is pressed».
  • Control: They allow you to add control logic, such as loops and conditions, using blocks such as «repeat [10]» or «if [condition] then».
  • Sensors: Blocks that detect specific conditions, such as «touching [edge]» or «distance to [object]».
  • Operators: They include blocks for performing mathematical and logical operations, such as addition, subtraction and comparisons.
  • Variables: They allow you to create and manipulate variables, which is useful for storing data and tracking information within the game.

Sprites and backgrounds

In Scratch, sprites and backgrounds are the main visual elements used to build a game. On the one hand, sprites are the characters and objects that move and interact on the game stage. Each sprite can have multiple costumes (appearances) and scripts (commands) associated with it. To create or modify a sprite, follow these steps:

  1. Creating a sprite: Click on the «Choose a sprite from the library», «Draw a new sprite» or «Upload a sprite from your computer» button.
  2. Edit costumes: Use the costume editor to draw or modify the sprite’s appearance.
  3. Add scripts: Drag code blocks into the scripts area to define the sprite’s behaviour. For example, you can create a script to move the sprite to the right when the right arrow key is pressed.

Meanwhile, backgrounds are the images used to set the scene in the game. You can change the backgrounds to reflect different levels, environments or situations within the game. To create or edit a background, follow these steps:

  1. Set up a fund: Click on «Choose a background from the library», «Create a new background» or «Upload a background from your computer».
  2. Edit backgrounds: Use the background editor to draw or edit background images.
  3. Change backgrounds: Use code blocks to change the backgrounds during the game; for example, «change background to [forest]» when the player moves on to a new level.

Preliminary steps

If you want to know how to make a game in Scratch, there are a few important preliminary steps you need to follow first. These include creating a Scratch account and familiarising yourself with the key elements of the interface. Below, we’ll guide you through these essential steps.

Creating an account

To save and share your projects in Scratch, you need an account. Creating an account on Scratch is simple and free. Here are the steps to follow:

  • Go to the Scratch website: Open your web browser and go to the official Scratch website at [scratch.mit.edu](https://scratch.mit.edu).
  • Register: On the home page, click the «Join Scratch» button in the top right-hand corner. Complete the registration form by entering a username, password and your email address. Make sure you choose a username and password that are secure and easy to remember.
  • Verify your account: Once you have registered, you will receive a confirmation email. Open the email and follow the link provided to activate your account.
  • Log in: Once your account has been activated, return to the Scratch homepage and click on «Log in». Enter your username and password to access your account.

Key interface elements

Getting to grips with the Scratch interface is crucial to being able to navigate it and use all the tools available to create your game. That said, the Scratch interface is divided into several key sections:

  • Toolbar: The toolbar is at the top of the screen and contains options for saving, loading and sharing your projects. You can also access settings and help from here.
  • Block area: This is the section on the left-hand side of the screen where all the code blocks are located. The blocks are organised into categories such as Motion, Appearance, Sound, Events, Control, Sensors, Operators and Variables. You can drag and drop these blocks into the script area to create your scripts.
  • Scripts section: The scripts area is in the centre of the screen. This is where you assemble and organise blocks of code to define the behaviour of your sprites and the game as a whole.
  • Setting: The stage is in the top right-hand corner of the screen. This is the area where you can see your sprites in action and how they interact with each other and with the background. You can resize the stage and adjust its appearance as required.
  • List of sprites: Below the stage, you’ll find the list of sprites. Here you can see all the sprites you’ve added to your project. You can select, edit and programme each sprite individually. You can also add new sprites from this section.
  • Costume Editor: The costume editor allows you to draw or import images for your sprites. You can access this editor by clicking on the «Costumes» tab when a sprite is selected.
  • Sound editor: Much like the costume editor, the sound editor allows you to add and edit sounds for your sprites. You can access this editor by clicking on the «Sounds» tab.
  • Extension bar: The extensions bar is located at the bottom of the screen and allows you to add extra features to your project, such as hardware integration (for example, micro:bit) or the option to use advanced blocks for mathematical and scientific operations.

A tutorial on how to create a simple game in Scratch

Creating a game in Scratch can be a fun and educational experience. In this tutorial, we’ll guide you step by step through the process of creating a simple platform game. By the end, you’ll have a basic game in which a character can move and jump between platforms, collect items and reach a final goal.

Add sprites and backgrounds to include characters and scenes

The first step in creating a platform game in Scratch is to add sprites and backgrounds. To do this, we recommend:

  1. Create the main character: Click on «Choose a sprite from the library» and select a character you like. If you prefer, you can «Draw a new sprite» or «Upload a sprite» from your computer. Name the sprite «Player» to keep everything organised.
  2. Add platforms: Create a new sprite for the platforms. You can «Paint a new sprite» and draw a rectangle to serve as a platform. Name this sprite «Platform». Then duplicate this sprite to create multiple platforms on the stage, placing them in different positions.
  3. Set up a fund: Click on «Choose a background» and select a suitable background for your platform game. If you prefer, you can «Paint a new background» or «Upload a background» from your computer. Make sure the background fits in with the game’s theme.

Programming the basic movements of sprites

Next, it’s time to start programming the most basic movements. Let’s continue looking at how to make a platform game in Scratch:

1. The main character’s movements.

  • Select the «Player» sprite and go to the «Code» tab.
  • Add the following blocks so that the character moves left and right when the arrow keys are pressed:

     «`scratch

     when the [right arrow v] key is pressed

     move 10 steps

 

     when the [left arrow v] key is pressed

     move (-10) steps

     «`

  • To make the character jump, add the following blocks:

     «`scratch

     when the [space v] key is pressed

     repeat 10 times

       change and by 10

     wait 0.1 seconds

     «`

2. Gravity and platforms.

  • To simulate gravity, add the following script:

     «`scratch

     forever

       change to -5

       wait 0.1 seconds

     «`

  • To stop the player when they touch a platform, add:

     «`scratch

     forever

       Is it [Platform v]?

         set and (and Platform)

       wait 0.1 seconds

     «`

Creating interactions for the characters

Once we have the characters, scenes and movements, we need to move on to the interactions. The process is as follows:

1. Collection of objects.

  • Add a sprite representing the object to be collected (for example, a star).
  • Programme the object’s sprite so that it disappears when the main character touches it:

     «`scratch

     forever

       Is [Player v] playing?

         hide

       wait 0.1 seconds

     «`

2. Ultimate goal.

  • Create a sprite to represent the game’s final goal (for example, a door).
  • Add a script so that the game pauses when the main character reaches the finish line:

     «`scratch

     forever

       Is [Player v] playing?

         say [You’ve won!] for 2 seconds

         stop everyone

     «`

Add sounds and music

Finally, in this brief guide on how to make a platform game in Scratch, we’ll talk about sounds and music.

1- Sounds of movement and jumping.

  • Select the «Player» sprite and go to the «Sounds» tab.
  • Choose or upload a sound for movement and jumping.
  • Add sound blocks to the movement and jump script:

     «`scratch

     when the [right arrow v] key is pressed

     to make a sound [to walk v]

     move 10 steps

 

     when the [space v] key is pressed

     play sound [skip v]

     «`

2. Background music.

  • Go to the «Sounds» tab at the bottom of the stage.
  • Choose or upload some background music.
  • Add a script to play the background music on a continuous loop:

     «`scratch

     when you click [green flag v]

     forever

       play sound [background music v] until it finishes

     «`

3- Sound effects for collected items and the final goal.

  • Select the sprite for the object to be collected and add a sound to play when the object is collected.
  • Add a script to play the sound when the player touches the object:

     «`scratch

     forever

       Is [Player v] playing?

         play a sound [collect v]

         hide

       wait 0.1 seconds

     «`

  • Select the finish line sprite and add a sound to play when the finish line is reached.
  • Add a script to play the sound when the player touches the finish line:

     «`scratch

     forever

       Is [Player v] playing?

         play sound [goal achieved v]

         say [You’ve won!] for 2 seconds

         stop everyone

     «`

How to share your game

Now you know how to create a game in Scratch. And not only that, you’ve finished making it, so the next step is to share it with others.

Sharing your project not only allows you to showcase your work, but also gives you the opportunity to receive valuable feedback that can help you improve.

Let’s see how to share your game on Scratch and how to get feedback to improve it.

Publish on Scratch to share with the community

Here is a step-by-step guide to publishing your game:

  1. Saving your project: Before publishing your game, make sure everything is working properly. Save your project by clicking the «Save now» button in the top right-hand corner.
  2. Publish the project: Once your project has been saved, look for the «Share» button, also in the top right-hand corner. Click on it to publish your game on Scratch. When you do this, your project becomes public and accessible to other Scratch users. It will now appear on your profile and in the ‘Shared Projects’ section on Scratch.
  3. Add a description: On the project page, click on «View project» and then on the text field below «Instructions». Here you can describe how to play your game, which keys to use and any other relevant details. You can also add «Notes and Credits» to give credit to any resources you’ve used, such as images or sounds that you haven’t created yourself.
  4. Labels and studies: Add tags to your project to make it easier to find. For example, you could use tags such as «platforms», «adventure» or «easy game». If you’re part of a Scratch studio, you can add your project to those studios so that it can be seen by a wider audience.

Receiving feedback to improve the game

Finally, once your game has been published, other Scratch users will be able to leave comments. These comments may give you ideas on how to improve your game or highlight any problems they have encountered.

We recommend that you encourage positive and constructive feedback by responding to comments in a friendly manner and thanking users for their suggestions.

However, if you’d like to receive feedback on specific aspects of your game, you can mention this in the description or in the comments section of the project.

For example, you could ask players for their views on the game’s difficulty, the level design or the character controls. You could also share your project on Scratch forums or on social media where there are communities interested in game development.

Finally, use the comments and feedback you’ve received to improve your game. Make the necessary changes and save a new version of the project.

Scratch lets you update your project without losing your comments or previous versions. Simply click «Edit» on your project, make your changes and save the project again.

Conclusions

As we have seen, Scratch is an educational tool that makes it easy to get started with programming through a visual and accessible approach.

It offers benefits such as its intuitive interface, the wide range of resources available, and the opportunity to develop key skills in logical thinking and problem-solving.

Through this guide, you have learnt how to make a game in Scratch. We have covered topics ranging from creating sprites and backgrounds to programming movements and adding sounds. These steps not only help you build a working game, but also illustrate the basic principles of programming in a practical and fun way.

Furthermore, sharing your project with the Scratch community and receiving feedback is crucial for continuous improvement and learning. This process not only encourages creativity, but also helps to develop a mindset of lifelong learning.

All in all, Scratch is a powerful platform for anyone interested in taking their first steps into the world of programming.

Share this guide on how to make a game in Scratch quickly and easily with others!

Share in:

Related articles

What is ChatGPT's competence?

Online Course ChatGPT Artificial Intelligence Online Course AI with Chatbots and Copilot Online Course Generative AI There are several alternatives to ChatGPT that offer similar functionalities to this artificial intelligence developed by OpenAI. In this way, these tools

9 applications of natural language processing

Natural language processing (NLP) is a sub-discipline of artificial intelligence that aims to create machines or systems that have the ability to manipulate human language in written and spoken form. Today, natural language processing

Don't fall for the mystery QR code scam!

Cybercriminals are maliciously using mysterious QR codes to carry out phishing attacks in disguise. Many people place inordinate trust in QR codes because, until recently, we did not hear about scams or cyber attacks that

Scroll to Top