Just a helper structure for the FlxSprite
animation system.
Constructor
new(parent:FlxAnimationController, name:String, frames:Array<Int>, frameRate:Float = 0.0, looped:Bool = true, flipX:Bool = false, flipY:Bool = false)
Parameters:
name | What this animation should be called (e.g. |
---|---|
frames | An array of numbers indicating what frames to play in what order (e.g. |
frameRate | The speed in frames per second that the animation should play at (e.g. |
looped | Whether or not the animation is looped or just plays once. |
flipX | Whether or not the frames of this animation are horizontally flipped. |
flipY | Whether or not the frames of this animation are vertically flipped. |
Variables
curFrame:Int = 0
Keeps track of the current frame of animation. This is NOT an index into the tile sheet, but the frame number in the animation object.
delay:Float
Seconds between frames (inverse of the framerate)
frameDuration:Float = 0
Seconds between frames (inverse of the framerate)
Note: FlxFrameCollections
and FlxAtlasFrames
may have their own duration set per-frame,
those values will override this value.
frameRate:Float
Animation frameRate - the speed in frames per second that the animation should play at.
loopPoint:Int = 0
The custom loop point for this animation. This allows you to skip the first few frames of an animation when looping.
timeScale:Float = 1.0
How fast or slow time should pass for this animation.
Similar to FlxAnimationController
's timeScale
, but won't effect other animations.
5.4.1
.Methods
play(Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
Starts this animation playback.
Parameters:
Force | Whether to force this animation to restart. |
---|---|
Reversed | Whether to play animation backwards or not. |
Frame | The frame number in this animation you want to start from ( |