How To Make Basic & Advanced Math Games In Scratch

How To Make Basic & Advanced Math Games In Scratch & Level Up Your Skills

By Akriti Anand

Coding and math have an unbreakable bond that none of us can deny. We have always been fascinated by the combination of Math and Coding since the beginning of coding. 

Have you ever attempted to create a basic or advanced Math game in Scratch

We begin with Math projects to understand the fundamentals of coding because they are very compatible and have a long history with coding. 

Let’s try to make a basic & advanced Math project in Scratch!

Basic & Advanced Math Games In Scratch 

Now, you’re probably wondering where to begin. Don’t worry, we’ve got your back no matter where you start.

These basic and advanced Math Scratch games can even go on for a long time, as the more Math topics you learn, the more questions you can add to your Math game.

Today, I’ll take you step by step through the process of creating a basic & advanced Math game in Scratch.

Let’s begin with a basic Math game project. In this project, we will create a game using two sprites

The first sprite will be our player, and the second sprite will be our opponent, and they will compete in a race. The project will resemble the image below:

Math Games In Scratch

Here, we’ll start with a simple Math calculation question, and with each correct answer, the cat (our player) will advance a step. 

Meanwhile, the Dog (Opponent) will advance with each incorrect answer. Finally, whoever crosses the finish line first wins the game. 

For reference you can check this link- https://Scratch.mit.edu/projects/634110754/ 

Steps To Make Basic & Advanced Math Game In Scratch 

Sounds interesting? Let’s hop right into it and practice this Math game by following the given steps below: 

  • First, visit https://Scratch.mit.edu/ to sign in, click on the top right corner where it says Sign in, and enter your ID and password as shown image below. 
Math Games In Scratch
  • Once you are logged in, click on Create option that you can see on the top left corner of the menu bar. 
Math Games In Scratch

Note – We can create projects without logging in, but you won’t be able to share them on Scratch or with anyone, and you won’t be able to save them online. This means that if they disappear by accident, they’re gone for good. And you don’t want to waste your time, so always sign in first.

  • Now, you must be able to see the creator’s screen of Scratch so, let’s have a quick introduction to this screen.  

We have Block Palette: which contains all blocks that we might use when we code for the project. 

Math Games In Scratch

Script area: where we place all the blocks for coding.

Math Games In Scratch

Stage: where we see the output of our project.

Math Games In Scratch

Sprites’ property section: where we see the details related to selected sprite.

Math Games In Scratch
  • Now, Let’s add sprites of our choice. First, add a sprite to be the player by clicking on choose a sprite option.
Math Games In Scratch
  • Now select the sprite you would like to go with from the screen that looks like the one shown in the image below.
Math Games In Scratch
  • Repeat step 5 and add another sprite to be the opponent. 
  • Now, we’ll add the third sprite i.e. the finish line. We can either choose a sprite that matches the pattern of the finish line or draw it ourselves by selecting the print option from the add sprite menu.
Math Games In Scratch
  • Now you see a screen like the one shown below to draw your sprite.
Math Games In Scratch
  • You can draw simple patterns using the square option.
Math Games In Scratch
  • Now add a backdrop by clicking on the draw option to draw tracks to give an attractive background or you can simply choose any backdrop from Choose a backdrop option.
Math Games In Scratch
  • Now let’s go back to the code section. Here, first, we will create variables that will be useful in this project.  
  • Click the variables option from the block palette and create four variables. 
Math Games In Scratch
  • Now, we have one Operators option in the block palette that we can use to add mathematical questions. Because we will be doing basic calculations, we will use blocks for addition, subtraction, multiplication, and so on. 

Here is a list of operators that will be used in both the basic and advanced Math games:

Math Games In Scratch
  • Now, click on backdrops as we will code for asking questions in the backdrop. 

We will create a loop of questions that iterate itself until anyone of them will win. 

To repeat in such conditions we will use the Repeat Until block from control option with = and or operator from operators option in block palette. Start adding blocks after When clicked block from events

  • Then, we will store the random numbers in each iteration using the pick random block from operators option with a set block from Variables options in the block palette.  
  • Finally to ask the question we will use the Ask block from the Sensing option with the join block to combine the numbers with operators as string values to display the question. 
  • Lastly, we will add if condition block from the Control option in which we will check the answer with the Answer block from sensing. 

So, here we will ask the question for addition and if the answer is correct we will broadcast a message cat else we will broadcast Dog for a wrong answer using a broadcast block from the Events option. 

Also, add a wait block to give an interval of a couple of seconds after each question.  

  • Your code must look like the one in the image below:
Math Games In Scratch
  • Now, click on cat sprite to code for a cat as we have finished the coding for asking questions. 
  • For a cat, we will make it move 20 steps using move block from Motion if the broadcasted message is a cat.  

In addition, we will set the cat wins variable to 0 and make it return to the starting position every time the game is launched.

Finally, we will check to see if it will cross the finish line and set the cat wins variable to 1 to end the game if it does. 

Refer to the code in the image below.

Math Games In Scratch
  • For Dog, we will make it move 20 steps using move block from Motion if the broadcasted message is Dog.  

In addition, we will set the dog wins variable to 0 at the start of the game and make it return to the starting position every time the game begins. 

Finally, if it crosses the finish line, we set the dog wins variable to 1 to end the game as the dog wins. 

Refer to the code in the image below.

Math Games In Scratch
  • Now, click on the green flag to check if your basic Math game is asking you questions like the one shown in the image below.
Math Games In Scratch

Note: For more fun, I’ve included one sound block for each of the sprites.

Congrats you made it. 

Conclusion

Now that you’ve mastered the basic Math technique for creating Math questions in Scratch, why not put your Math skills to the test and try to add more different operators to make this a more advanced Math game?

By giving two seconds after each question, try to add as many operators as you can from the Operators options such as Multiplication, Division, and many more.

Check out the image below for a reference of how I added more operators to create more Maths questions to make the game more advanced.

Math Games In Scratch

Learn Scratch at BrightChamps with its specially designed curriculum that makes learning programming easy for students in Grade 1-12.

BrightChamps also teaches a variety of other programs that help kids build a foundation in computer programming through activities, interactive lessons, and other means.

Akriti Anand

⭐⭐⭐⭐⭐

I am a coding instructor who enjoys the creative aspect of coding. This motivates me to continue learning and exploring coding, as well as to share my knowledge with others. At BrightChamps, my goal is to teach kids all about coding in a fun, interactive, and educational way so that they are well-prepared for the future. Learn from Me

Categories

Learn Scratch Animation

Become A Certified Scratch Game Developer for FREE!

100% Risk-Free. No Credit Card Required

Get Scratch Certified

Related Articles

Trending Articles

Free Coding Resources

Free Kids Coding Resources📕

Receive a copy of our Top 10 FREE Resources for your Kids

Success! 🎉

Share This