Cat and Mouse is a type of game that involves constant pursuit and near captures, and is based on how a cat in real life hunts a mouse. This page contains a tutorial on how to create one.
In this version of the game, the cat will constantly chase the user's mouse pointer until it has been caught or the game has been stopped.
Creating the Game
when green flag clicked go to x:(0) y:(0) // Resets the Cat at the start of the game. repeat until <touching [mouse-pointer v]> // Repeats the loop until the cat touches the mouse. if on edge, bounce point towards [mouse-pointer v] move (10) steps // Moves the cat ten steps. end say [Got You!]
|Note:||At this point the game is playable and can be left as is.|
To create a score create a variable called "Score". Then add this script to the cat sprite.
when green flag clicked set [Score v] to (0) // Resets the score at the start of the game. repeat until <touching [mouse-pointer v]> wait (1) seconds // Waits one second before adding to the score. change [Score v] by (1) // Changes the score by one. end
Making the Game More Challenging
To make the game more challenging the cat sprite could speed up as the score get higher, by modifying the first script.
when green flag clicked go to x:(0) y:(0) repeat until <touching [mouse-pointer v]> if on edge, bounce point towards [mouse-pointer v] move ((10)+((Score)/(2))) steps // Moves the cat ten steps plus half of the current score. end say [Got You!]
Taking it Further
Other additions to the game might adding obstacles the mouse can hide behind, or special backdrops or sound that play when the cat catches the mouse or a certain score is reached.