1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-11-25 13:45:49 +00:00

Fix Eggnog santa not playing plus Ugh fix

This commit is contained in:
CheemsAndFriends 2024-09-11 18:29:31 +02:00
parent 2aa9e58f67
commit 0dc286e1d3
2 changed files with 32 additions and 13 deletions

View file

@ -95,7 +95,7 @@ class FlxAtlasSprite extends FlxAnimate
*/ */
public function hasAnimation(id:String):Bool public function hasAnimation(id:String):Bool
{ {
return getLabelIndex(id) != -1; return getLabelIndex(id) != -1 || anim.symbolDictionary.exists(id);
} }
/** /**
@ -112,6 +112,8 @@ class FlxAtlasSprite extends FlxAnimate
var looping:Bool = false; var looping:Bool = false;
public var ignoreExclusionPref:Array<String> = [];
/** /**
* Plays an animation. * Plays an animation.
* @param id A string ID of the animation to play. * @param id A string ID of the animation to play.
@ -124,7 +126,25 @@ class FlxAtlasSprite extends FlxAnimate
public function playAnimation(id:String, restart:Bool = false, ignoreOther:Bool = false, loop:Bool = false, startFrame:Int = 0):Void public function playAnimation(id:String, restart:Bool = false, ignoreOther:Bool = false, loop:Bool = false, startFrame:Int = 0):Void
{ {
// Skip if not allowed to play animations. // Skip if not allowed to play animations.
if ((!canPlayOtherAnims && !ignoreOther)) return; if ((!canPlayOtherAnims))
{
if (this.currentAnimation == id && restart) {}
else if (ignoreExclusionPref != null && ignoreExclusionPref.length > 0)
{
var detected:Bool = false;
for (entry in ignoreExclusionPref)
{
if (StringTools.startsWith(id, entry))
{
detected = true;
break;
}
}
if (!detected) return;
}
else
return;
}
if (anim == null) return; if (anim == null) return;
@ -132,16 +152,12 @@ class FlxAtlasSprite extends FlxAnimate
if (this.currentAnimation == id && !restart) if (this.currentAnimation == id && !restart)
{ {
if (anim.isPlaying) if (!anim.isPlaying)
{
// Skip if animation is already playing.
return;
}
else
{ {
// Resume animation if it's paused. // Resume animation if it's paused.
anim.play('', restart, false, startFrame); anim.play('', restart, false, startFrame);
} }
return;
} }
else else
{ {
@ -174,18 +190,19 @@ class FlxAtlasSprite extends FlxAnimate
// Move to the first frame of the animation. // Move to the first frame of the animation.
// goToFrameLabel(id); // goToFrameLabel(id);
trace('Playing animation $id'); trace('Playing animation $id');
if (this.anim.symbolDictionary.exists(id) || (this.anim.getByName(id) != null))
{
this.anim.play(id, restart, false, startFrame);
}
// Only call goToFrameLabel if there is a frame label with that name. This prevents annoying warnings! // Only call goToFrameLabel if there is a frame label with that name. This prevents annoying warnings!
if (getFrameLabelNames().indexOf(id) != -1) if (getFrameLabelNames().indexOf(id) != -1)
{ {
goToFrameLabel(id); goToFrameLabel(id);
fr = anim.getFrameLabel(id); fr = anim.getFrameLabel(id);
anim.curFrame += startFrame;
}
else
{
this.anim.play(id, restart, false, startFrame);
fr = null;
} }
anim.curFrame += startFrame;
this.currentAnimation = id; this.currentAnimation = id;
} }

View file

@ -166,6 +166,8 @@ class AnimateAtlasCharacter extends BaseCharacter
this.mainSprite = sprite; this.mainSprite = sprite;
mainSprite.ignoreExclusionPref = ["sing"];
// This forces the atlas to recalcuate its width and height // This forces the atlas to recalcuate its width and height
this.mainSprite.alpha = 0.0001; this.mainSprite.alpha = 0.0001;
this.mainSprite.draw(); this.mainSprite.draw();