1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-26 06:37:23 +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
{
return getLabelIndex(id) != -1;
return getLabelIndex(id) != -1 || anim.symbolDictionary.exists(id);
}
/**
@ -112,6 +112,8 @@ class FlxAtlasSprite extends FlxAnimate
var looping:Bool = false;
public var ignoreExclusionPref:Array<String> = [];
/**
* Plays an animation.
* @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
{
// 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;
@ -132,16 +152,12 @@ class FlxAtlasSprite extends FlxAnimate
if (this.currentAnimation == id && !restart)
{
if (anim.isPlaying)
{
// Skip if animation is already playing.
return;
}
else
if (!anim.isPlaying)
{
// Resume animation if it's paused.
anim.play('', restart, false, startFrame);
}
return;
}
else
{
@ -174,18 +190,19 @@ class FlxAtlasSprite extends FlxAnimate
// Move to the first frame of the animation.
// goToFrameLabel(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!
if (getFrameLabelNames().indexOf(id) != -1)
{
goToFrameLabel(id);
fr = anim.getFrameLabel(id);
anim.curFrame += startFrame;
}
else
{
this.anim.play(id, restart, false, startFrame);
fr = null;
}
anim.curFrame += startFrame;
this.currentAnimation = id;
}

View file

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