An example of a Mouse Trail project.

A mouse trail is a trail of any shapes that follows the mouse pointer around the screen. They are usually used in projects for fun, decoration, and detail. Usually mouse trails use the Looks Blocks and/or Motion Blocks.

Common project types that can include mouse trails include parallaxes.


Important Blocks to Use

point towards (mouse-pointer v)

go to (mouse-pointer v)
distance to (mouse-pointer v)

Sprite Mouse Trails

Choosing a Sprite

Before you can start your mouse trail, you need to pick out a shape, even if it is just a simple colored circle. It can be anything, but it shouldn't be too big. You can find some good sprites in the sprite library.

If you want, you can give the sprite different costumes for more variety. This will make the mousetrail more colorful and creative. If this is done, make sure to include a script that tells the clones to change to a random costume.

Base Scripts

There are many ways to edit a mouse trail, but this is a basic template. You can make the sprites do whatever you want. To begin to make a mouse trail, start with this script.

Note Note: This script is customizable. See Customizing for more information.
when gf clicked
go to (mouse-pointer v)
forever
    create clone of (myself v)
    point towards (mouse-pointer v)
    move (distance to (mouse-pointer v)) steps
    wait (0.001) seconds
end

when I start as a clone
point towards (mouse-pointer v)
repeat (10)
    change [ghost v] effect by (10)
end
delete this clone

See Customizing for help on editing this script. A project with sprite mouse trails can be found here.

Pen Mouse Trails

The Pen blocks can be used to make mouse trails. To make a mouse trail drawn with pen, use these scripts:

Note Note: This script is customizable. See Customizing for more information.
when flag clicked
forever
    erase all
    wait (0.01) seconds
end
when flag clicked
pen up
set pen color to [#F00]
hide
point in direction (90)
forever
    go to (mouse-pointer v)
    create clone of (myself v)
    change pen (color v) by (5)
end
when I start as a clone
set pen size to (10)
repeat until <touching (edge v)?>
    pen up
    move (10) steps
    pen down
end
delete this clone

See Customizing for help on editing this script. Some of the dots might stay on the project until they touch a corner. A project with a pen mouse trail can be seen here.

Customizing

Try changing the values of colors, sizes, and ghost effects etc. Try using a pick random () to () block instead of numbers. Maybe try a turn cw (42) degrees somewhere in between, or use a change [color v] effect by (23) or choose other graphic effects or put in your own ideas.

Using the (() / ()) block will mostly smoothen the movement of the sprite.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.