Spine Spine

Spine Dragon
Spine is a third-party 2D skeletal animation tool from Esoteric Software. The nuget package can be found here.

Spine is fully integrated into Delta Engine - although a licence from Esoteric Software is required to create your own custom animations.

Go to Menu > Export. In the Export Dialog, turn on Radiobutton "JSON" and tick the "Create Atlas" option.

Spine will create three files: A png, an atlas file (to 'unpack' the png) and a json file specifying the animations. To add a custom animation to your project, simply drag these files into the Content Manager as you would any other.

The animation can be loaded in code by doing this:
 var skeleton = new SpineSkeleton("Atlas", "Json", Rectangle.One);

Where "Atlas" is the Delta Engine name for the atlas file, "Json" is the name for the animation and the last parameter determines the position and size it will be drawn at. 

As with all content, you do not need to specify the file suffix, so, for now, you may need to look into the ContentMetaData to confirm what name was given to each file; It's likely that in the future it will be unified into a single content entry.

Note also that you do not need to reference the png file since it is already referenced within the atlas.

To invoke an animation, simply do something like this:


Where dragon is your SpineSkeleton and "bite" is the name you gave your animation in Spine.

To make the animation loop endlessly instead do this:


Animations can also be queued up by doing this:

 dragon.SetAnimation("bite"); dragon.AddAnimation("scratch");

Which will bite and then scratch. More advanced features are possible - for example animations can be blended into one another and code can be triggered when an animation completes.

For more detail please look at the Spine Tests or sample projects.