class flixel.addons.effects.FlxTrail extends FlxTypedGroup<FlxSprite>

Available on all platforms

Nothing too fancy, just a handy little class to attach a trail effect to a FlxSprite. * Inspired by the way "Buck" from the inofficial #flixel IRC channel * creates a trail effect for the character in his game. * Feel free to use this class and adjust it to your needs. * @author Gama11

Instance Fields

var delay:Int

How often to update the trail.

var framesEnabled:Bool

Whether to check for frame changes of the "parent" FlxSprite or not.

var rotationsEnabled:Bool

Whether to check for angle changes or not.

var scalesEnabled:Bool

Whether to check for scale changes or not.

var solid:Bool

Determines whether trailsprites are solid or not. False by default.

var sprite:FlxSprite

Stores the FlxSprite the trail is attached to.

var xEnabled:Bool

Whether to check for X changes or not.

var yEnabled:Bool

Whether to check for Y changes or not.

function new(Sprite:FlxSprite, ?Image:Dynamic = null, ?Length:Int = 10, ?Delay:Int = 3, ?Alpha:Float = 0.4f, ?Diff:Float = 0.05f):Void

Creates a new FlxTrail effect for a specific FlxSprite. * *

Sprite

The FlxSprite the trail is attached to. *

Image

The image to ues for the trailsprites. Optional, uses the sprite's graphic if null. *

Length

The amount of trailsprites to create. *

Delay

How often to update the trail. 0 updates every frame. *

Alpha

The alpha value for the very first trailsprite. *

Diff

How much lower the alpha of the next trailsprite is.

function changeGraphic(Image:Dynamic):Void

In case you want to change the trailsprite image in runtime... * *

Image

The image the sprites should load

function changeValuesEnabled(Angle:Bool, ?X:Bool = true, ?Y:Bool = true, ?Scale:Bool = true):Void

Handy little function to change which events affect the trail. * *

Angle

Whether the trail reacts to angle changes or not. *

X

Whether the trail reacts to x changes or not. *

Y

Whether the trail reacts to y changes or not. *

Scale

Wheater the trail reacts to scale changes or not.

function destroy():Void

function increaseLength(Amount:Int):Void

A function to add a specific number of sprites to the trail to increase its length. * *

Amount

The amount of sprites to add to the trail.

function resetTrail():Void

function update():Void

Updates positions and other values according to the delay that has been set.