How to Create a Game in Scratch? | Step-by-Step Tutorial For Beginners
Last Updated :
31 Jul, 2024
Scratch is a high-level visual programming language that interacts with users with diagrams and blocks that has the basics of the program inbuilt in it. Scratch is used to make interactive programs, especially for kids using the block kind of interface. In Scratch, we can create games also. Before we make a game, we have to first understand what exactly a game is. A game is an activity or we can say a sport that includes skill, knowledge, etc, in which we follow some certain set of rules or instructions to win against the opponent. It is a major source of entertainment. Many kinds of interactive games exist that create fun, enjoyment, or for educational purposes. For every game, two things are compulsory:
- The player must interact with the game with some kind of control over it.
- The player must have an objective to complete within the stipulated number of chances or times.
How to Create a Game in Scratch
Scratch allows the programmer to make a wide variety of games with lots of ways to control the flow of the game. It has huge collections of blocks that give greater flexibility to the user to code the games. To start planning a game in Scratch, one needs to think of these steps:
- Start with a plan: It is the initial step of game development. We make a plan that includes: what kind of game we want to develop, what is the theme of the game, what are the characters of the game, a game is multiple players or single-player game, what is the difficulty level of the game like easy, moderate, or tough, etc.
- Make an Objective: The objective is the main step of the game. In which we plan an objective that the player has to complete.
- Figure out a visual sprite: In this step, we plan and create the characters of our game you want to create a game of car racing so we need a car sprite. In Scratch, we can use a predefined sprite or we can create our own sprite.
- Pick up a background: Background is also a crucial element of a game. So choose a background according to the theme of the game. Scratch contains various backgrounds you can choose one of them according to your requirements.
- Add coding: After choosing the background and sprite now the next step is to add coding. Now we add some set of instructions in the sprite through which we can control and add the movement of the sprite with the help of different types of blocks present in the Scratch.
- Add more features: You can add more features in your game like you can add sound in your game which makes it more attractive with the help of a sound panel etc.
Creating Games in Scratch
Let's make an interactive game from scratch using the below concept:
1. Objective and theme
A monkey (sprite of scratch) if touches fruits, will get points, but if the monkey touches living organisms, the monkey will lose its lifeline which is 3. After the monkey touches the living organism 3 times, the game is over. The monkey moves from left to right or vice versa with the movement of the cursor.
2. Figure Out a Visual sprite
In this game, a monkey is the sprite or actor of the scene. We can choose a monkey by following the given steps:
Step 1: Go to the costumes panel and then click on choose a costume as highlighted below:

Step 2: Now choose monkey from the list.

And this is how we get a monkey as our main character.

Similarly, we choose one banana and one gobo in this manner.

3. Choose a backdrop
Now let's choose a suitable backdrop as the stage background. So to choose a backdrop follow the following steps:
Step 1: On the bottom right corner of the stage, click on the option "choose a backdrop".

Step 2: Now choose a "blue sky" backdrop from the list.

And this is how we get a backdrop for our game.

4. Program monkey
Let's write code for the monkey sprite. As monkey is our main actor, so all the main function or action is performed by this monkey. We need two variables, one for displaying the score and the second for game lifeline count(upto 3 chances).
- Step 1: Goto the variable block and click on "make a variable" and make two variables named "score" and "game_over".
- Step 2: Click on the event block and choose 1st control block denoting the start of the program(drag it to center).
- Step 3: Goto variable block and drag "set score to 0" below the above step.
- Step 4: Goto variable block and drag "set game_over to 0" below the above step.
- Step 5: Go to motion block and set the rotation style of the monkey as left to right, drag it below the above step.
- Step 6: Goto the control block and drag the forever block.
- Step 7: Goto the motion block and drag "if on edge, bounce" inside the forever block.
- Step 8: Goto motion block and drag "set x to mouse x" inside forever block.
- Step 9: Goto control block and drag if block, condition of if block is game_over == 3.
- Step 10: Goto the look block and drag "say game_over" inside the if block.
- Step 11: Goto the control block and drag "wait for 1 sec" inside the if block.
- Step 12: Goto the control block and drag "stop all" block inside the if block.
- Step 13: Goto the control block and drag another if block, condition of if block is touching bananas(found in sensing block).
- Step 14: Goto the variable block and drag "change score to 10" inside the if block.
- Step 15: Goto the control block and drag "wait for 1 sec" inside the if block.
- Step 16: Goto the control block and drag another if block, condition of if block is touching gobos(found in sensing block).
- Step 17: Goto variable block and drag "change game_over to 1" inside the if block.
- Step 18: Goto control block and drag "wait for 1 sec" inside the if block.
Step 19: Run the program

5. Program Banana
Let's write a code for banana. The working of banana is when the monkey touches the banana the score increase.
- Step 1: Click on the event block and choose 1st control block denoting the start of the program(drag it to center)
- Step 2: Goto the motion block and drag set rotation style below the above step and set the value of this block to don't rotate.
- Step 3: Goto the control block and drag the "forever block" below the above step.
- Step 4: Goto the motion block and drag "go to x O y O" inside the forever block. Fill the O of x with pick random -200 to 200(found in operator block) inside forever block.
- Step 5: Goto the motion block and drag "point in direction 180" inside the forever block.
- Step 6: Goto control block and drag "repeat until O" block inside forever block. Fill the O with touching sand color(found in sensing block)
- Step 7: Goto the motion block and drag the "move 5 steps" block inside repeat until block.
- Step 8: Run the program.

6. Program Gobo
Let's write a code for Gobo. The working of the gobo is when the monkey touches the gobo the monkey will lose its lifeline which is 3. After the monkey touches the Gobo 3 times, the game is over.
- Step 1: Click on the event block and choose 1st control block denoting the start of the program(drag it to center)
- Step 2: Goto the motion block and drag set rotation style below the above step and set the value of this block to don't rotate.
- Step 3: Goto the control block and drag the "forever block" below the above step.
- Step 4: Goto the motion block and drag "go to x O y O" inside the forever block. Fill the O of x with pick random -210 to 202(found in operator block) inside forever block.
- Step 5: Goto the motion block and drag "point in direction 180" inside the forever block.
- Step 6: Goto control block and drag "repeat until O" block inside forever block. Fill the O with touching sand color(found in sensing block)
- Step 7: Goto the motion block and drag the "move 5 steps" block inside repeat until block.
- Step 8: Run the program.

7. Final output
The final game is ready now run the game and start playing like as shown below:
Similar Reads
Computer Fundamentals Tutorial This Computer Fundamentals Tutorial covers everything from basic to advanced concepts, including computer hardware, software, operating systems, peripherals, etc. Whether you're a beginner or an experienced professional, this tutorial will enhance your computer skills and take them to the next level
4 min read
Fundamental
Computer HardwareComputer hardware refers to the physical components of a computer that you can see and touch. These components work together to process input and deliver output based on user instructions. In this article, weâll explore the different types of computer hardware, their functions, and how they interact
10 min read
What is a Computer Software?Computer Software serves as the backbone of all digital devices and systems. It is an integral part of modern technology. Unlike hardware which comprises physical components, software is intangible and exists as a code written in programming language. This article focuses on discussing computer soft
8 min read
Central Processing Unit (CPU)The Central Processing Unit (CPU) is like the brain of a computer. Itâs the part that does most of the thinking, calculating, and decision-making to make your computer work. Whether youâre playing a game, typing a school assignment, or watching a video, the CPU is busy handling all the instructions
6 min read
Input DevicesInput devices are important parts of a computer that help us communicate with the system. These devices let us send data or commands to the computer, allowing it to process information and perform tasks. Simply put, an input device is any tool we use to give the computer instructions, whether it's t
11 min read
Output DevicesOutput devices are hardware that display or produce the results of a computer's processing. They convert digital data into formats we can see, hear, or touch. The output device may produce audio, video, printed paper or any other form of output. Output devices convert the computer data to human unde
9 min read
Memory
Computer MemoryMemory is the electronic storage space where a computer keeps the instructions and data it needs to access quickly. It's the place where information is stored for immediate use. Memory is an important component of a computer, as without it, the system wouldnât operate correctly. The computerâs opera
9 min read
What is a Storage Device? Definition, Types, ExamplesThe storage unit is a part of the computer system which is employed to store the information and instructions to be processed. A storage device is an integral part of the computer hardware which stores information/data to process the result of any computational work. Without a storage device, a comp
11 min read
Primary MemoryPrimary storage or memory is also known as the main memory, which is the part of the computer that stores current data, programs, and instructions. Primary storage is stored in the motherboard which results in the data from and to primary storage can be read and written at a very good pace.Need of P
4 min read
Secondary MemorySecondary memory, also known as secondary storage, refers to the storage devices and systems used to store data persistently, even when the computer is powered off. Unlike primary memory (RAM), which is fast and temporary, secondary memory is slower but offers much larger storage capacities. Some Ex
7 min read
Hard Disk Drive (HDD) Secondary MemoryPrimary memory, like RAM, is limited and volatile, losing data when power is off. Secondary memory solves this by providing large, permanent storage for data and programs.A hard disk drive (HDD) is a fixed storage device inside a computer that is used for long-term data storage. Unlike RAM, HDDs ret
11 min read
Application Software
MS Word Tutorial - Learn How to Use Microsoft Word (2025 Updated)Microsoft Word remains one of the most powerful word processing program in the world. First released in 1983, this word processing software has grown to serve approximately 750 million people every month. Also, MS Word occupies 4.1% of the market share for productivity software.With features like re
9 min read
MS Excel Tutorial - Learn Excel Online FreeExcel, one of the powerful spreadsheet programs for managing large datasets, performing calculations, and creating visualizations for data analysis. Developed and introduced by Microsoft in 1985, Excel is mostly used in analysis, data entry, accounting, and many more data-driven tasks.Now, if you ar
11 min read
What is a Web Browser and How does it Work?The web browser is an application software used to explore the World Wide Web (WWW). It acts as a platform that allows users to access information from the Internet by serving as an interface between the client (user) and the server. The browser sends requests to servers for web documents and servic
4 min read
What is a Excel SpreadsheetIf you search only about Spreadsheet then you will find it is a computer applicaion that save, display, and manipulate data in rows and columns. In the year 1978 first spreadsheet program is developed by Daniel Bricklin and Bob Frankston named as VisiCalc. Now, in the recent year Microsoft Excel is
12 min read
System Software
Programming Languages
C Programming Language TutorialC is a general-purpose mid-level programming language developed by Dennis M. Ritchie at Bell Laboratories in 1972. It was initially used for the development of UNIX operating system, but it later became popular for a wide range of applications. Today, C remains one of the top three most widely used
5 min read
Python Tutorial - Learn Python Programming LanguagePython is one of the most popular programming languages. Itâs simple to use, packed with features and supported by a wide range of libraries and frameworks. Its clean syntax makes it beginner-friendly. It'sA high-level language, used in web development, data science, automation, AI and more.Known fo
10 min read
Java TutorialJava is a high-level, object-oriented programming language used to build web apps, mobile applications, and enterprise software systems. It is known for its Write Once, Run Anywhere capability, which means code written in Java can run on any device that supports the Java Virtual Machine (JVM).Java s
10 min read
JavaScript TutorialJavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. It's an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side: On the client side, Jav
11 min read