Fix playAnim (#781)

* playanim if it was good

* dont mind me

---------

Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com>
This commit is contained in:
Care
2025-10-04 10:43:32 +07:00
committed by GitHub
co-authored by ⍚~Nex
parent a296b33c0f
commit dba8200854
+6 -12
View File
@@ -126,7 +126,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
// hate how it looks like but hey at least its optimized and fast - Nex
if (!debugMode && isAnimFinished()) {
var name = getAnimName() + '-loop';
if (hasAnimation(name))
if (hasAnim(name))
playAnim(name, null, lastAnimContext);
}
}
@@ -307,7 +307,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
public function playAnim(AnimName:String, ?Force:Null<Bool>, Context:PlayAnimContext = NONE, Reversed:Bool = false, Frame:Int = 0):Void
{
if (AnimName == null)
if (AnimName == null || (!hasAnim(AnimName) && !debugMode))
return;
if (Force == null) {
@@ -318,16 +318,10 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
if (animateAtlas != null)
{
@:privateAccess
// if (!animateAtlas.anim.animsMap.exists(AnimName) && !animateAtlas.anim.symbolDictionary.exists(AnimName)) return;
animateAtlas.anim.play(AnimName, Force, Reversed, Frame);
atlasPlayingAnim = AnimName;
}
else
{
if (!animation.exists(AnimName) && !debugMode)
return;
animation.play(AnimName, Force, Reversed, Frame);
}
else animation.play(AnimName, Force, Reversed, Frame);
var daOffset = getAnimOffset(AnimName);
frameOffset.set(daOffset.x, daOffset.y);
@@ -414,9 +408,9 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
}
// Backwards compat (the names used to be all different and it sucked, please lets use the same format in the future) - Nex
public inline function hasAnimation(AnimName:String) return hasAnim(AnimName);
public inline function removeAnimation(name:String) return removeAnim(name);
public inline function stopAnimation() return stopAnim();
@:dox(hide) public inline function hasAnimation(AnimName:String) return hasAnim(AnimName);
@:dox(hide) public inline function removeAnimation(name:String) return removeAnim(name);
@:dox(hide) public inline function stopAnimation() return stopAnim();
#end
// Getter / Setters