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.
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.
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.
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.
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.
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.
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 as 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.
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 TipsMake.com has made below and edit and add to your liking.
Programming Code for Mouse
Programming 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.
At the interface you were just navigated to, click the green flag button to start testing the game you just programmed.
Above is the complete detailed guide on how to program the Cat and Mouse game with Scratch that TipsMake.com wants to introduce to you. Wish you success in programming and experiencing this game.
You should read it
- 'All things' about mice playing Tt eSports TALON BLU Avago 3050
- 8 things to know when buying a computer mouse
- How to fix mouse lag in Windows 11/10
- This site will help you master the technique of using the mouse to the point of 'superiority' to treat all types of games
- Mouse training game, quick and quick eye game on the computer
- Basic Scratch tutorial for beginners
- Top best wireless mouse 2024
- The best mouse models are worth owning in 2019
May be interested
- How to Create a Racing Game in Scratchthis wikihow teaches you how to create a basic racing game using mit's free scratch program. the main point of this racing game is to complete the track in as little time as possible without crashing. open scratch. go to...
- Link Download Scratch 461scratch 2 offline editor - or simply the scratch 2 app - is a free educational program that lets you easily code and develop your own software.
- Evaluate mouse game Tt eSports TALON BLU Avago 3050tt esports talon blu game mouse avago 3050 is a dedicated mouse aimed at gamers who love simplicity, sophistication, elegance and not too focused on features.
- Logitech Pro mouse game is good?mouse logitech pro professional gaming with stylish design, size suitable for vietnamese is a perfect choice for gamers who need speed and high accuracy.
- 'All things' about mice playing Tt eSports TALON BLU Avago 3050in esports talon blu avago 3050 is a dedicated mouse game, not only equipped with omron switch, which allows professional gamers to click with high speed, tt esports talon blu avago 3050 is also designed to suit user's hand, even if used for a long time, feels very comfortable.
- The Best Online Programming Platforms for Kidsprogramming platforms are designed for kids to help them understand how to create software and applications. here are the best programming platforms for kids.
- Mouse training game, quick and quick eye game on the computerstudents can practice their mouse with simple games that will help them use the mouse more quickly.
- The 9-year-old boy has written more than 30 mobile gamescurrently, this 9-year-old boy is writing a hide-and-seek game with the main character being a programmed bat to escape.
- This site will help you master the technique of using the mouse to the point of 'superiority' to treat all types of gamesbut with this interesting website, you can test how well your mouse is using, and evaluate whether the mouse is good or not, without having to turn on the game. .
- How to Use Scratchscratch is a great educational tool developed by mit. it enables nearly anyone to experiment with the basics of vector art, animation, and game development. you can create projects by yourself, or you can collaborate with other creators...