i agree with gray

This commit is contained in:
Yoshman29
2022-12-26 15:37:59 +01:00
parent 696bc286fb
commit de50b3eb29
8 changed files with 132 additions and 19 deletions
+15 -10
View File
@@ -90,16 +90,7 @@ class XMLUtil {
return spr;
}
/**
* Adds an XML animation to `sprite`.
* @param sprite Destination sprite
* @param anim Animation (Must be a `anim` XML node)
*/
public static function addXMLAnimation(sprite:FlxSprite, anim:Access, loop:Bool = false):ErrorCode {
var animType:XMLAnimType = NONE;
if (sprite is XMLSprite)
animType = cast(sprite, XMLSprite).spriteAnimType;
public static function extractAnimFromXML(anim:Access, animType:XMLAnimType = NONE, loop:Bool = false):AnimData {
var animData:AnimData = {
name: null,
anim: null,
@@ -127,6 +118,20 @@ class XMLUtil {
}
}
return animData;
}
/**
* Adds an XML animation to `sprite`.
* @param sprite Destination sprite
* @param anim Animation (Must be a `anim` XML node)
*/
public static function addXMLAnimation(sprite:FlxSprite, anim:Access, loop:Bool = false):ErrorCode {
var animType:XMLAnimType = NONE;
if (sprite is XMLSprite)
animType = cast(sprite, XMLSprite).spriteAnimType;
var animData = extractAnimFromXML(anim, animType, loop);
if (animData.name != null && animData.anim != null) {
if (animData.fps <= 0 #if web || animData.fps == null #end) animData.fps = 24;