Making a Trail

Материал из Поле цифровой дидактики
Файл:Sprite trail effect.PNG
Blur/trail effects in a fireworks project.

Trails on sprites create a type of fireworks effect. Trails have the characteristics of following the main sprite's path and fading out. There are two main ways to create this, using the Create Clone of () and Pen Down block.

Clone Method

The clone method is a more straightforward way to create this type of effect. It utilizes the ghost effect.

when green flag clicked
forever
  create clone of (myself v)
end

when I start as a clone
repeat (5)//Replace this with an estimate of how long you want your trail
  change [ghost v] effect by (20)//100 divided by the number of times repeated equals the ghost effect number. This makes the clone fade out.
end
delete this clone

Pen Method

This method works by slowly "blotting out" pen marks by stamping a translucent sprite the size of the background continuously. Place the script below in a sprite the size of the stage and the desired background color. Шаблон:Note

when green flag clicked
go [backwards v] (1) layers
set size to (150)
go to x: (0) y: (0)
set [ghost v] effect to (20)
forever
stamp
end

Place this script in the sprite you want to leave a trail on:

when green flag clicked
forever
  stamp
end