From 2c52720244a6b30a166d601185bf589ad12a0a15 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 7 Oct 2024 00:10:43 +0200 Subject: [PATCH] Added getAnim and isAnimAtEnd --- source/funkin/backend/FunkinSprite.hx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index d18585ae1..fa79a95b0 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -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; @@ -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) @@ -325,6 +328,12 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I lastAnimContext = Context; } + public function getAnim(name:String):OneOfTwo { + if(animateAtlas != null) + return animateAtlas.anim.getByName(name); + return animation.getByName(name); + } + public inline function getAnimOffset(name:String) { if (animOffsets.exists(name)) @@ -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