@@ -328,7 +328,31 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
328328 lastAnimContext = Context ;
329329 }
330330
331- public function getAnim (name : String ): OneOfTwo <FlxAnimation , FlxSymbolAnimation > {
331+ public inline function addAnim (name : String , prefix : String , frameRate : Float = 24 , ? looped : Bool , ? forced : Bool , ? indices : Array <Int >, x : Float = 0 , y : Float = 0 , animType : XMLAnimType = NONE )
332+ {
333+ return XMLUtil .addAnimToSprite (this , {
334+ name : name ,
335+ anim : prefix ,
336+ fps : frameRate ,
337+ loop : looped == null ? animType == LOOP : looped ,
338+ animType : animType ,
339+ x : x ,
340+ y : y ,
341+ indices : indices ,
342+ forced : forced
343+ });
344+ }
345+
346+ public inline function removeAnim (name : String )
347+ {
348+ if (animateAtlas != null )
349+ @:privateAccess animateAtlas .anim .animsMap .remove (name );
350+ else
351+ animation .remove (name );
352+ }
353+
354+ public function getAnim (name : String ): OneOfTwo <FlxAnimation , FlxSymbolAnimation >
355+ {
332356 if (animateAtlas != null )
333357 return animateAtlas .anim .getByName (name );
334358 return animation .getByName (name );
@@ -341,7 +365,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
341365 return FlxPoint .weak (0 , 0 );
342366 }
343367
344- public inline function hasAnimation (AnimName : String ): Bool @:privateAccess
368+ public inline function hasAnim (AnimName : String ): Bool @:privateAccess
345369 return animateAtlas != null ? (animateAtlas .anim .animsMap .exists (AnimName )
346370 || animateAtlas .anim .symbolDictionary .exists (AnimName )) : animation .exists (AnimName );
347371
@@ -364,21 +388,15 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
364388 return animateAtlas != null ? animateAtlas .anim .reversed : animation .curAnim != null ? animation .curAnim .reversed : false ;
365389 }
366390
367- public inline function removeAnimation (name : String ) {
368- if (animateAtlas != null )
369- @:privateAccess animateAtlas .anim .animsMap .remove (name );
370- else
371- animation .remove (name );
372- }
373-
374391 public inline function getNameList (): Array <String > {
375392 if (animateAtlas != null )
376393 return [for (name in @:privateAccess animateAtlas .anim .animsMap .keys ()) name ];
377394 else
378395 return animation .getNameList ();
379396 }
380397
381- public inline function stopAnimation () {
398+ public inline function stopAnim ()
399+ {
382400 if (animateAtlas != null )
383401 animateAtlas .anim .pause ();
384402 else
@@ -393,6 +411,11 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
393411 public inline function isAnimAtEnd () {
394412 return animateAtlas != null ? animateAtlas .anim .isAtEnd : (animation .curAnim != null ? animation .curAnim .isAtEnd : false );
395413 }
414+
415+ // Backwards compat (the names used to be all different and it sucked, please lets use the same format in the future) - Nex
416+ public inline function hasAnimation (AnimName : String ) return hasAnim (AnimName );
417+ public inline function removeAnimation (name : String ) return removeAnim (name );
418+ public inline function stopAnimation () return stopAnim ();
396419 #end
397420
398421 // Getter / Setters
0 commit comments