Skip to content

Commit

Permalink
Added getAnim and isAnimAtEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
NeeEoo committed Oct 6, 2024
1 parent a8b6e8e commit 2c52720
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion source/funkin/backend/FunkinSprite.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package funkin.backend;

import flixel.animation.FlxAnimation;
import flxanimate.animate.FlxAnim.FlxSymbolAnimation;
import funkin.backend.utils.XMLUtil.BeatAnim;
import funkin.backend.utils.XMLUtil.AnimData;
import funkin.backend.utils.XMLUtil.IXMLEvents;
Expand All @@ -11,6 +13,7 @@ import funkin.backend.system.interfaces.IOffsetCompatible;
import flixel.math.FlxMatrix;
import flixel.math.FlxRect;
import flixel.math.FlxPoint;
import flixel.util.typeLimit.OneOfTwo;
import funkin.backend.system.interfaces.IBeatReceiver;

enum abstract XMLAnimType(Int)
Expand Down Expand Up @@ -325,6 +328,12 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
lastAnimContext = Context;
}

public function getAnim(name:String):OneOfTwo<FlxAnimation, FlxSymbolAnimation> {
if(animateAtlas != null)
return animateAtlas.anim.getByName(name);
return animation.getByName(name);
}

public inline function getAnimOffset(name:String)
{
if (animOffsets.exists(name))
Expand Down Expand Up @@ -378,7 +387,11 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I

public inline function isAnimFinished()
{
return animateAtlas != null ? (animateAtlas.anim.finished) : (animation.curAnim != null ? animation.curAnim.finished : true);
return animateAtlas != null ? animateAtlas.anim.finished : (animation.curAnim != null ? animation.curAnim.finished : true);
}

public inline function isAnimAtEnd() {
return animateAtlas != null ? animateAtlas.anim.isAtEnd : (animation.curAnim != null ? animation.curAnim.isAtEnd : false);
}
#end

Expand Down

0 comments on commit 2c52720

Please sign in to comment.