How to Make a Mouse Trail Game on Scratch? [In 4 Easy Steps]
- Sachin Upadhayay |
- September 2, 2024
Updated By
Reviewed By
Want to create an interesting game of Scratch from scratch? Fret not! This guide will teach you how to make a Mouse Trail Game on Scratch in 4 simple steps. Stick with us till the end to create this interesting game!
Looking to learn Scratch coding? Explore Wiingy’s Online Scratch Coding Classes For Kids to learn from top Scratch coding experts.
This is Chapter 2.6 in the
Scratch Game Tutorial
How To Get the Mouse to Follow You on Scratch?
Let’s make a Mouse Trail game on Scratch today. In the above graphic, you can see sprites [cat, ball] following your mouse pointer and creating Mouse Trails with various effects [color, position, shape, transparency]. The steps involved in making of this Mouse Trail game on Scratch have been explained below:
- Pick a sprite
- Create a clone of the sprite
- Add more effects to the mouse trail
- Switch the object (sprite)
How to Make Mouse Trail Effect Scratch Game?
The detailed step-by-step process involved in making a Mouse Trail game on Scratch is explained below:
Step 1: Pick a sprite [Cat]
- Let us choose the first object you wish to click.
- If you want to select a different sprite for this Mouse Trail, delete the cat sprite.
- You may have a mouse trail made up of scratch cats, hearts, stars, balloons, rainbows, or anything else you like!
- Click on the “Choose a Sprite” icon.
- Let’s start by creating a Scratch cat trail.
- Click on Cat, you can pick any character from scratch’s library of sprites.
- After clicking on Cat, you will be able to see the cat in the stage area.
- Make the cat follow your mouse pointer.
- From the motion category drag & drop the “go-to” random position block.
- Click on the menu and choose “mouse-pointer”.
- Put the “go-to” block inside a forever loop and click on it.
- Here you can see the cat is always going to your mouse pointer.
- Click on the green flag icon to begin the movement. As a result, the sprite follows your mouse when you click the green flag.
- “When the green flag clicked” can be moved up by dragging.
Step 2: Create a clone of the sprite
You now have one sprite, not precisely a mouse trail, following your mouse. Now make several Scratch cats follow your mouse pointer to create a trail. Here are the steps to achieving this:
- Drag “make a clone of myself” from the control box and then click it.
- Anywhere you click “Make a clone of myself”, a new Scratch cat is created.
- These cat clones can also have multiple moves by using programming.
- Drag and drop the piece labeled “when I start as a clone.”
- You can place any code under there, and when clones are made, they will execute that code,
- When creating a Scratch clone, change the color of the cat.
- Select the color and its value of 25 by dragging and dropping the “change effect by” block.
- You can see changes in color when they’re created by clicking on the “create a clone of” block.
- You might include a repeat loop and make a few color changes.
- The “repeat” block should be moved around as seen below.
- This clone can be added to or removed.
- Drag & drop “delete this clone” block as shown below.
- Put the “create a clone of myself” block inside the forever loop,
- Drag and drop the “create a clone of myself” block to the “forever” loop and underneath to the “go-to” block.
- Click on it and move your mouse pointer over the screen.
- Here you can see that after their color is changed, they disappear off the screen.
- And now you can drag the cat around and wherever it goes, it creates a clone.
Note:- It is usually not recommended to have a “create a clone of myself” block inside of a forever loop, because if a sprite creates too many clones, the computer will run really slowly. The reason it is okay here is that when a clone is created, it does a little animation, but then it gets deleted. So, you can never get too many clones.
Step 3: Add more effects to the Mouse Trail Game
- You can add different kinds of things inside an infinite loop to get different effects.
- From the motion category, drag and drop the “change X by 10” block inside the repeat loop.
- Click on the “green flag”.
- So now when you are creating the clones, they are changing their color and they are also having a movement on the screen because of the “changing X by 10” block.
- Similarly, you can also add the change in the Y block.
- Drag & drop the “change y by 10” block as shown below.
- Click on the “green flag”.
- Now clone cats are changing their color and then they’re going upward.
- To make it a falling effect you can change Y by a negative value.
- Change the 10 to -10 as shown below.
- Click on the “green flag”.
- Let’s make the items in the Mouse Trail spread out in every direction.
- Drag & drop “point in direction” and “pick random” blocks as shown below and click on them.
- Make a sprite point in a certain direction and if you put the block “pick random” and put the value “zero to 360”, then it will point in a random direction from zero to 360 degrees.
- And if you add the “move 10 steps” block and click on it, it makes the sprite go forward in whatever direction it’s pointing.
- Drag & drop the “point in direction” & “pick random” blocks as shown below.
- Drag & drop the “move steps” block as shown below.
- Click on the “green flag”.
- If you make the clones point in a random direction, and then put them inside the repeat loop & you move 10 steps, then before you start the repeat loop, they point somewhere random and then they repeatedly move in that direction 10 times. And that’s how you can get this explosion effect.
Step 4: Switch between the sprites
- If you ever want to switch the objects in your Mouse Trail, you can just click on the “costumes” tab and pick a new costume.
- Let’s try something else other than the cat.
- Click on the “Costumes” section.
- Click on the “Choose a Costume”.
- Click on the “Ball-e”
- Click on the “Code”
- Click on the “green flag”.
- You can try putting in a “change size by” block and put in a negative number[-8], and then the items will get smaller as they go out.
- Drag & drop the “change size by” block as shown below.
- Click on the “green flag”.
- You can fade them as they go outward, or you can put in a change ghost effect block. If you change the ghost effect of a sprite, it gets more transparent.
- Drag & drop the “change effect by” block and click the menu and select “ghost” effect.
- Set the ghost effect by value five.
- Click on the “green flag”.
Congratulations! you have completed the mouse trail game on Scratch!
Looking to learn Scratch coding? Explore Wiingy’s Online Scratch Coding Classes For Kids to learn from top Scratch coding experts.
Frequently Asked Questions (FAQs)
How do you make a mouse trail on Scratch?
You can create a mouse trail on Scratch in 4 easy steps:
- Select a sprite
- Now, create a clone of the sprite
- Add more effects
- Switch the sprite, like a ball.
What is the easiest game on Scratch to make?
The maze game is a simple and easy game on Scratch game. In this type of game, one has to create a maze and have to guide the sprite to avoid the maze walls and other difficulties.
How to make a sprite to follow my mouse pointer?
To make the sprite follow your mouse, first make a motion block for the sprite to move by using the blocks “when the green flag is clicked”, “point towards mouse-pointer”, and “move 10 steps”. Now, put this block in a forever loop. You can change the speed by changing the steps.
What is a mouse trail game on Scratch?
In the type of game on Scratch, the objective is to create a trail-like effect for the sprite. The trail will follow your mouse creating a trail with various colors, positions, shapes, and transparency.
Is Scratch for 9-year-olds?
Yes, a 9-year-old can start using and learning with Scratch. Scratch uses a block-based coding language where the blocks are dragged and dropped onto the editor. This platform helps kids learn about coding by creating fun and interesting projects.
Creating games on Scratch is fun but also educational. Creating these games will also sharpen your logical and analytical thinking and improve your creativity. This is a great platform for kids to get started with coding as it teaches coding in a fun and interactive environment.
For more Scratch game tutorials, check out our compilation of some of the most popular Scratch Games for Kids such as maze game, clicker game, flappy bird game along with step-by-step instructions on how to build those games.