How to Make a Mouse Trail

Материал из Поле цифровой дидактики

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

pointtowardsmouse-pointergotomouse-pointerdistancetomouse-pointer

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

whenclickedgotomouse-pointerforevercreatecloneofmyselfpointtowardsmouse-pointermovedistancetomouse-pointerstepswait0.001secsendwhenIstartasaclonepointtowardsmouse-pointerrepeat10changeghosteffectby10enddeletethisclone

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

whenclickedforevereraseallwait0.01secsend
whenclickedpenupsetpencolortohidepointindirection90forevergotomouse-pointercreatecloneofmyselfchangepencolorby10end
whenIstartasaclonesetpensizeto10repeatuntiltouchingedge?penupmove10stepspendownenddeletethisclone

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 pickrandomto block instead of numbers. Maybe try a turn42degrees somewhere in between, or use a changecoloreffectby23 or choose other graphic effects or put in your own ideas.

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