Programming the game Cat and Mouse with Scratch

We have learned how to program the game Hung Tao and Racing Animals with Scratch . Next, let's learn how to program the game Cat and Mouse.

Table of Contents

How to program the game Cat and Mouse

From the name Cat and Mouse, you can grasp the structure of this game. So let's start programming this game.

Step 1: Choose a wallpaper for the game

To make the game more interesting, the first thing to do is to choose a background. You can choose the scene of the mouse-tailed cat indoors, outdoors, on the beach... by clicking on Choose background in the bottom right corner.

Programming the game Cat and Mouse with Scratch

Step 2: Set up character for game

This is a Cat and Mouse game, so of course we will need 2 characters Cat and Mouse. Go to Add Character in the Character Frame to choose 2 characters Cat and Mouse according to your preferences.

Programming the game Cat and Mouse with Scratch

Don't forget to delete the default character if you don't want to use it by clicking on the trash icon next to the character.

Step 3: Programming the Cat character

We need to set up the cat to move flexibly according to our control, thereby quickly catching the mouse. The programming steps for the cat will be as follows:

  • Drag the code When clicking the green flag of the Event section into the programming section.
  • Select Continuous code in Control section.
  • Add Go to the Motion section mouse pointer .
  • Point towards the object (_) in Motion. The (_) part selects the object as the mouse.

Programming the game Cat and Mouse with Scratch

Step 4: Programming the Mouse character

To make the mouse run everywhere and hide from the cat, you will need to program it as follows:

  • Drag the code When clicking the green flag of the Event item into the programming interface.
  • Add Continuous under Controls .
  • In the Motion section , add Glide for (_) seconds to random position. The (_) box should be set to 1 so that the mouse moves at a moderate rate.
  • Finally add Restart if edge touched also under Motion.

Programming the game Cat and Mouse with Scratch

To make the game more vivid, you can add sound for the mouse every time it is caught by the cat by programming as follows:

  • Add If code (_) then make it a child of Continuous code. In (_) add Touching code (_) and select cat character.
  • Insert the Start Sound code (_) under the Sound section . In the (_) section you can set the sound to match the mouse when it is caught by the cat.

Programming the game Cat and Mouse with Scratch

You can also set it up so that every time it is caught, the mouse will disappear and reappear in another location.

  • Drag the Hidden item in the Show into a child of the If (_) then code.
  • Insert code Go to random position under Move down.
  • Add the Wait (_) seconds code under Controls . In the (_) section you can set the number of seconds to wait for the mouse to reappear in the game interface.
  • Finally, insert the Show code in the Display section .

Programming the game Cat and Mouse with Scratch

Step 5: Publish the Cat and Mouse game

After completing all the above steps, you have finished programming the Cat and Mouse game. You can refer to the game programming code that Quantrimang has made below and edit and add to your liking.

Programming the game Cat and Mouse with Scratch Programming Code for Mouse

Programming the game Cat and Mouse with ScratchProgramming Code for Cats

Finally, you just need to publish the game you just programmed. Click View Project Page in the toolbar at the top of the screen to save the game and start the game experience.

Programming the game Cat and Mouse with Scratch

At the interface you were just navigated to, click the green flag button to start testing the game you just programmed.  Programming the game Cat and Mouse with Scratch

Above is the complete detailed guide on how to program the Cat and Mouse game with Scratch that Quantrimang wants to introduce to you. Wish you success in programming and experiencing this game.

Sign up and earn $1000 a day ⋙

Leave a Comment

Programming the game Cat and Mouse with Scratch

Programming the game Cat and Mouse with Scratch

We have learned how to program the game Catching Apples and Racing Animals with Scratch. Next, let's learn how to program the game Cat Chasing Mouse.

Top 8 Tips for Gaming Beginners

Top 8 Tips for Gaming Beginners

Whether you're a curious newcomer or someone looking to pick up an old controller, starting your gaming journey can be both exciting and intimidating. However, with the right advice, getting into gaming can be a fun and rewarding experience.

How to reset PS4 game controller

How to reset PS4 game controller

By simply resetting your PlayStation 4 controller, you can fix almost all pairing issues, as well as many other common problems.

Apple is developing a dedicated iOS game store

Apple is developing a dedicated iOS game store

If you are someone who likes to learn about iPhone and iOS operating system, you must have followed the development of classic game emulators for iPhone.

Top 10 best educational games for kids on mobile

Top 10 best educational games for kids on mobile

Most kids prefer to play rather than study. However, these mobile games that are both educational and entertaining will appeal to young kids.

How to play dinosaur games right on Android screen

How to play dinosaur games right on Android screen

The T-rex dinosaur game is very familiar to many people and you can enjoy this T-rex dinosaur game right on your Android screen.

Sword World Origin: Overview of 10 sects in the game

Sword World Origin: Overview of 10 sects in the game

Kiem The Origin - the mobile version of Kiem The on PC released by VNGGame. Like the previous PC version, Kiem The Origin owns 10 sects with 20 different systems for you to freely choose your own gameplay.

Call of Duty fights hacking by making real gamers invisible

Call of Duty fights hacking by making real gamers invisible

A new anti-hack, anti-cheat method is being developed by the game Call of Duty.

How to hide ads when playing games on your phone

How to hide ads when playing games on your phone

Turn off ads while playing games, something that many mobile gamers want after finishing a round.

How to get free mobile games on Epic Games Store

How to get free mobile games on Epic Games Store

Epic Games Store on Android has a free game download program like on PC. Here is a guide to get free mobile games on Epic Games Store.

Instructions for playing Pokemon catching game on Google

Instructions for playing Pokemon catching game on Google

Just by searching Pokemon names on Google, you will collect the latest Pokemon characters.

Tencent brings Android games to Microsoft Store Windows 11

Tencent brings Android games to Microsoft Store Windows 11

Earlier this year, Microsoft announced its decision to discontinue the Windows Subsystem for Android, which was designed to allow Android apps to run natively on Windows 11.

Special characters ϟ, ✿, \˚ㄥ˚\, ☎,☂, ☁ special characters or

Special characters ϟ, ✿, \˚ㄥ˚\, ☎,☂, ☁ special characters or

Special characters do not appear on the keyboard, but you have to find them in special ways. With the pre-made character table below, you just need to write the content or a character name that you want to put in the game, then copy the text format that you like best!

How to Never Pay for Games and Apps on Android

How to Never Pay for Games and Apps on Android

When it comes to making purchases on the Play Store, many people haven't spent any real money in years, thanks to Google Opinion Rewards.

Learn About Resizable BAR: Settings That Give You Extra Gaming Performance

Learn About Resizable BAR: Settings That Give You Extra Gaming Performance

If you don't know about Resizable BAR and how it improves performance, then chances are you have it disabled. Here's how you can enable Resizable Bar and what to expect from this feature.