Skip to content
13 changes: 13 additions & 0 deletions flixel/util/FlxTimer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,19 @@ class FlxTimer implements IFlxDestroyable
}
}

/***
* Ends a loop early and runs onComplete(), regardless of how much time is left.
*/
Comment thread
Vulpicula marked this conversation as resolved.
Outdated
public function completeEarly():Void
Comment thread
Vulpicula marked this conversation as resolved.
Outdated
{
if (active && !finished){
_timeCounter -= time;
_loopsCounter++;

onLoopFinished();
}
}

@:allow(flixel.util.FlxTimerManager)
function onLoopFinished():Void
{
Expand Down
Loading