From 35fd2005bca2fd09d88f6116a79b64b38afe86e4 Mon Sep 17 00:00:00 2001 From: Eric Myllyoja Date: Mon, 15 Aug 2022 05:04:09 -0400 Subject: [PATCH] Added loopPoint to FlxAnimation --- flixel/animation/FlxAnimation.hx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flixel/animation/FlxAnimation.hx b/flixel/animation/FlxAnimation.hx index a3a4d7e723..2039bb9758 100644 --- a/flixel/animation/FlxAnimation.hx +++ b/flixel/animation/FlxAnimation.hx @@ -43,6 +43,12 @@ class FlxAnimation extends FlxBaseAnimation */ public var looped(default, null):Bool = true; + /** + * The custom loop point for this animation. + * This allows you to skip the first few frames of an animation when looping. + */ + public var loopPoint:Int = 0; + /** * Whether or not this animation is being played backwards. */ @@ -191,7 +197,7 @@ class FlxAnimation extends FlxBaseAnimation _frameTimer -= delay; if (reversed) { - if (looped && curFrame == 0) + if (looped && curFrame == loopPoint) curFrame = numFrames - 1; else curFrame--; @@ -199,7 +205,7 @@ class FlxAnimation extends FlxBaseAnimation else { if (looped && curFrame == numFrames - 1) - curFrame = 0; + curFrame = loopPoint; else curFrame++; }