mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
Moved AnimationData into the data package
This commit is contained in:
parent
70584c6e88
commit
883ab87931
7 changed files with 56 additions and 5 deletions
|
@ -1,14 +1,60 @@
|
|||
package funkin.play;
|
||||
package funkin.data.animation;
|
||||
|
||||
class AnimationDataUtil
|
||||
{
|
||||
public static function toNamed(data:UnnamedAnimationData, ?name:String = ""):AnimationData
|
||||
{
|
||||
return {
|
||||
name: name,
|
||||
prefix: data.prefix,
|
||||
assetPath: data.assetPath,
|
||||
offsets: data.offsets,
|
||||
looped: data.looped,
|
||||
flipX: data.flipX,
|
||||
flipY: data.flipY,
|
||||
frameRate: data.frameRate,
|
||||
frameIndices: data.frameIndices
|
||||
};
|
||||
}
|
||||
|
||||
public static function toUnnamed(data:AnimationData):UnnamedAnimationData
|
||||
{
|
||||
return {
|
||||
prefix: data.prefix,
|
||||
assetPath: data.assetPath,
|
||||
offsets: data.offsets,
|
||||
looped: data.looped,
|
||||
flipX: data.flipX,
|
||||
flipY: data.flipY,
|
||||
frameRate: data.frameRate,
|
||||
frameIndices: data.frameIndices
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A data structure representing an animation in a spritesheet.
|
||||
* This is a generic data structure used by characters, stage props, and more!
|
||||
* BE CAREFUL when changing it.
|
||||
*/
|
||||
typedef AnimationData =
|
||||
{
|
||||
> UnnamedAnimationData,
|
||||
|
||||
/**
|
||||
* The name for the animation.
|
||||
* This should match the animation name queried by the game;
|
||||
* for example, characters need animations with names `idle`, `singDOWN`, `singUPmiss`, etc.
|
||||
*/
|
||||
var name:String;
|
||||
}
|
||||
|
||||
/**
|
||||
* A data structure representing an animation in a spritesheet.
|
||||
* This animation doesn't specify a name, that's presumably specified by the parent data structure.
|
||||
*/
|
||||
typedef UnnamedAnimationData =
|
||||
{
|
||||
/**
|
||||
* The prefix for the frames of the animation as defined by the XML file.
|
||||
* This will may or may not differ from the `name` of the animation,
|
|
@ -1,6 +1,6 @@
|
|||
package funkin.data.level;
|
||||
|
||||
import funkin.play.AnimationData;
|
||||
import funkin.data.animation.AnimationData;
|
||||
|
||||
/**
|
||||
* A type definition for the data in a story mode level JSON file.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.play.character;
|
||||
|
||||
import funkin.data.animation.AnimationData;
|
||||
import funkin.modding.events.ScriptEvent;
|
||||
import funkin.modding.events.ScriptEventDispatcher;
|
||||
import funkin.play.character.ScriptedCharacter.ScriptedAnimateAtlasCharacter;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.play.cutscene.dialogue;
|
||||
|
||||
import funkin.data.animation.AnimationData;
|
||||
import funkin.util.SerializerUtil;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package funkin.play.cutscene.dialogue;
|
||||
|
||||
import funkin.data.animation.AnimationData;
|
||||
|
||||
/**
|
||||
* Data about a conversation.
|
||||
* Includes what speakers are in the conversation, and what phrases they say.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package funkin.play.stage;
|
||||
|
||||
import funkin.data.animation.AnimationData;
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
import funkin.play.stage.ScriptedStage;
|
||||
import funkin.play.stage.Stage;
|
||||
|
|
|
@ -2,12 +2,12 @@ package funkin.util.assets;
|
|||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.graphics.frames.FlxFramesCollection;
|
||||
import funkin.play.AnimationData;
|
||||
import funkin.data.animation.AnimationData;
|
||||
|
||||
class FlxAnimationUtil
|
||||
{
|
||||
/**
|
||||
* Properly adds an animation to a sprite based on JSON data.
|
||||
* Properly adds an animation to a sprite based on the provided animation data.
|
||||
*/
|
||||
public static function addAtlasAnimation(target:FlxSprite, anim:AnimationData)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ class FlxAnimationUtil
|
|||
}
|
||||
|
||||
/**
|
||||
* Properly adds multiple animations to a sprite based on JSON data.
|
||||
* Properly adds multiple animations to a sprite based on the provided animation data.
|
||||
*/
|
||||
public static function addAtlasAnimations(target:FlxSprite, animations:Array<AnimationData>)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue