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
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 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. |