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.

Leave a Comment

Steam Top Sellers for the Week of October 19, 2026: PUBG Surges as Dota 2 Slips

Steam Top Sellers for the Week of October 19, 2026: PUBG Surges as Dota 2 Slips

See Steam's October 13–20, 2026 global revenue chart, from PUBG's rise to No. 1 to major gains for Call of Duty, Planet Zoo 2, and Battlefield 6.

Steam Top Sellers for the Week of October 12, 2026: What Rose and Fell

Steam Top Sellers for the Week of October 12, 2026: What Rose and Fell

Steam’s latest U.S. weekly chart covers October 6–13, 2026. See the biggest risers, falling titles, and what the revenue-based rankings do—and do not—tell you.

Steam Top Sellers for the Week of October 5, 2026: Games Rising and Falling

Steam Top Sellers for the Week of October 5, 2026: Games Rising and Falling

Steam’s latest weekly chart covers September 29–October 6, 2026. See which games climbed, slipped, returned, and what the rankings actually measure.

How to Use a Vegetable Steamer Basket

How to Use a Vegetable Steamer Basket

Master how to use a vegetable steamer basket for perfectly cooked, nutrient-rich vegetables in minutes. Follow this clear step-by-step guide to start steaming today.

How Long to Steam Broccoli in Microwave Steamer

How Long to Steam Broccoli in Microwave Steamer

How Long to Steam Broccoli in Microwave Steamer? Get the precise timing and step-by-step instructions for tender-crisp results that lock in nutrients and flavor.

Free Games for PC Steam

Free Games for PC Steam

Find and download the best free games for PC Steam with this complete guide. Learn how to browse, install, and play top free-to-play titles quickly.

How to Use Conair Steamer

How to Use Conair Steamer

How to Use Conair Steamer correctly to remove wrinkles fast from clothes and fabrics. Follow these clear steps for safe, effective results every time.

Shark Steamer Not Steaming

Shark Steamer Not Steaming

Shark Steamer Not Steaming? Follow these targeted troubleshooting steps to identify and fix the issue so your Shark steam cleaner works properly again.

How to Steam Fresh Broccoli

How to Steam Fresh Broccoli

Learn how to steam fresh broccoli perfectly in just five minutes. This simple stovetop method keeps nutrients intact and delivers tender-crisp results every time.

How to Steam Vegetables Without a Steamer

How to Steam Vegetables Without a Steamer

How to Steam Vegetables Without a Steamer using everyday kitchen tools like a pot, colander or microwave. Get crisp, nutrient-rich results with these proven methods.