This is a plugin for Matt Rix's Futile Framework, https://github.com/MattRix/Futile, that allows for animations to be loaded and played using FAnimSprite.
The naming convention of all assets must be as follows: SpriteID-Animation-FrameNum-Delay
ie) SuperDude-Jump-1-60
SuperDude-Run-1-30
SuperDude-Run-2-30
SuperDude-Run-3-30
SpriteID will be parsed as a string to be used for referencing sprite data.
Animation will be parsed as a string for which animation set it belongs to. ** is optional **
Frame is parsed as an int to be used for sorting frame list ** is optional, needs to be implemented **
Delay will be parsed as a float value. indicates FPS for animation to be played at. ** optional, uses 60FPS by default **
So, steps to use animations:- Replace all
Futile.atlasManager.LoadAtlas("path")
withFAnimationManager.Instance.LoadAtlas("path");
2)FAnimSprite construtor takes in the SpriteID (outlined in the Naming Convention)
FAnimSprite mySprite = new FAnimSprite("SuperDude");
3)To change the animation of the asset call setAnimation("animationName")
mySprite.setAnimation("Run");
4)To change the atlas/id of a sprite, just use FAnimSprite.load("SpriteID");
//mySprite is currently using the SuperDude sprite data. next line changes it to use EvilDude images and data
mySprite.load("EvilDude");
animations are played, during runtime. If you want to speed them up during their playback, just use it like the
examples below.
//speeds up the animation playback by 2x
mySprite.PlaySpeed = 2.0f;
//slows the animation playback to half
mySprite.PlaySpeed = 0.5f;
//the default speed, as in the delta time added to the delay is unchanged
mySprite.PlaySpeed = 1.0f;
-optimizations
-anything suggested by other users!