Use scratch to follow the mouse
Green highlight

Create a Scratch project where a sprite follows the mouse pointer, learning motion blocks, coordinates, and simple event-driven programming through hands-on play.

Orange shooting star
Download Guide
Collect Badge
Background blob
Challenge Image
Skill Badge
Table of contents

Step-by-step guide to make a sprite follow the mouse in Scratch

Here at SafeTube, we're on a mission to create a safer and more delightful internet. 😊

Scratch Tutorial Make Cat Follow Mouse Pointer

What you need
Mouse or trackpad, scratch account or scratch desktop

Step 1

Open Scratch and start a new project by clicking "Create" or opening the Scratch Desktop.

Step 2

Choose a sprite you like from the sprite library or upload one by clicking the sprite button.

Step 3

Pick a backdrop from the backdrop library to give your scene a fun background.

Step 4

In the Code area click Events and drag the "when green flag clicked" block into the scripts area.

Step 5

In Control drag a "forever" block and snap it under the "when green flag clicked" block.

Step 6

In Motion drag the "glide 1 secs to x: ( ) y: ( )" block and drop it inside the "forever" loop.

Step 7

Replace the x and y fields in the glide block with the "mouse x" and "mouse y" reporters from Sensing so the sprite moves toward the mouse pointer.

Step 8

In Motion add the "point towards [mouse-pointer]" block and place it just above the glide block so the sprite faces the pointer.

Step 9

Click the green flag to test and watch your sprite follow the mouse pointer across the stage.

Step 10

Change the glide time number to a smaller value to make the sprite follow faster or a larger value to make it smoother.

Step 11

Add a "when this sprite clicked" event and attach a "say" block so the sprite responds when you click it.

Step 12

Add a "say" block that shows the mouse x and mouse y using the "join" block and "mouse x" and "mouse y" reporters so you can learn the coordinates.

Step 13

Share your finished Scratch project on DIY.org so others can see how your sprite follows the mouse.

Final steps

You're almost there! Complete all the steps, bring your creation to life, post it, and conquer the challenge!

Complete & Share
Challenge badge placeholder
Challenge badge

Help!?

What can we use if we can't install Scratch Desktop?

If Scratch Desktop isn't available, open the same editor in a web browser at scratch.mit.edu or use the ScratchJr app and, because ScratchJr lacks 'mouse x'/'mouse y' reporters, replace the 'glide ... to mouse x mouse y' step with repeated 'move' blocks and manual touch control.

Why won't my sprite follow the mouse when I click the green flag?

If the sprite doesn't follow, make sure you actually clicked the green flag, that the 'forever' loop contains 'point towards mouse-pointer' placed above the 'glide 1 secs to x: (mouse x) y: (mouse y)' block with the mouse reporters correctly inserted, and that no other scripts are interrupting the motion.

How can I adapt this activity for different ages?

For younger children, increase the glide time and skip the 'join' mouse x/mouse y coordinate display so it's simpler, while older kids can add a 'speed' variable, calculate distance from sprite x/y to mouse x/y, and change glide time to simulate acceleration.

How can we extend or personalize the project to make it more interesting?

Add a 'when this sprite clicked' sound and 'next costume' blocks as in the instructions to animate on click, create extra sprites and a 'score' variable so players chase targets, change backdrops for levels, and then share the enhanced project on DIY.org.

Watch videos on how to make a sprite follow the mouse in Scratch

Here at SafeTube, we're on a mission to create a safer and more delightful internet. 😊

Scratch - Following The Cursor

4 Videos

Facts about Scratch programming for kids

🧩 Block-based (visual) programming was created so beginners can snap logic together like puzzle pieces and avoid syntax errors.

🧠 Event blocks like "when green flag clicked" let your project react to clicks or messages instead of running only top-to-bottom.

🖱️ Scratch reports mouse x/y coordinates on a stage that goes from -240 to 240 (x) and -180 to 180 (y).

🐱 The Scratch Cat is the default sprite kids start with — it's a friendly mascot used in millions of shared projects!

🎯 To make a sprite follow the mouse smoothly, use "point towards mouse-pointer" plus small "move" steps; "go to mouse-pointer" teleports instantly.

How do I make a Scratch sprite follow the mouse pointer?

Open Scratch, pick or draw a sprite, then add a When Green Flag clicked block. Inside it, use a forever loop and either the Motion block Go to mouse-pointer or Point Towards mouse-pointer combined with Glide 0.1 secs to mouse-pointer for smooth movement. To teach coordinates, show how Mouse x and Mouse y (Sensing) can set X and Y positions. Add simple events like When this sprite clicked to change costume or play sound for interactivity.

What materials and setup do I need to try this Scratch activity at home?

You need a computer or tablet with internet access and a modern browser (or the Scratch app), and a mouse or trackpad. A free Scratch account is optional but helps save projects. Prepare headphones for sound, printed or digital step instructions, and adult supervision for younger kids. For class groups, have extra screens or share pairs. No special coding tools are required—just Scratch and a curious child.

What ages is this Scratch mouse-following activity suitable for?

This activity suits children roughly 7–12 years old who can use a keyboard/mouse and follow simple instructions; beginners will learn motion blocks and coordinates. Younger kids (5–7) can try a simpler version in ScratchJr with adult help. Older kids and teens can extend the project with variables, lists, or multiple sprites. Adjust pace and explanations to fit each childs experience level and attention span.

What are the benefits of building a sprite that follows the mouse in Scratch?

Making a sprite follow the mouse teaches basic motion blocks, coordinates, and event-driven programming in a hands-on way. It builds debugging skills, spatial reasoning, and computational thinking while encouraging creativity through sprites and costumes. The activity is low-pressure, fosters problem-solving, and can boost confidence as children see immediate cause-and-effect. It's also easy to expand for teamwork or classroom demonstrations.
DIY Yeti Character
Join Frame
Flying Text Box

One subscription, many ways to play and learn.

Try for free

Only $6.99 after trial. No credit card required

Use scratch to follow the mouse. Activities for Kids.