1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-12-09 13:39:12 +00:00
Funkin/source/funkin/graphics/FunkinAnimationController.hx
Abnormal fcfde61b24 Replace FlxAnimate with flixel-animate
Co-Authored-By: Hyper_ <40342021+NotHyper-474@users.noreply.github.com>
Co-Authored-By: MaybeMaru <97055307+MaybeMaru@users.noreply.github.com>
Co-Authored-By: Trayfellow <48515908+trayfellow@users.noreply.github.com>
2025-11-21 18:53:42 -07:00

36 lines
896 B
Haxe

package funkin.graphics;
import funkin.graphics.FunkinSprite;
import animate.FlxAnimateController;
class FunkinAnimationController extends FlxAnimateController
{
/**
* The sprite that this animation controller is attached to.
*/
var _parentSprite:FunkinSprite;
public function new(sprite:FunkinSprite)
{
super(sprite);
_parentSprite = sprite;
}
/**
* We override `FlxAnimationController`'s `play` method to account for texture atlases.
*/
public override function play(animName:String, force = false, reversed = false, frame = 0):Void
{
if (animName == null || animName == '') animName = _parentSprite.getDefaultSymbol();
if (!_parentSprite.hasAnimation(animName))
{
// Skip if the animation doesn't exist
trace('Animation ${animName} does not exist!');
return;
}
super.play(animName, force, reversed, frame);
}
}