• assetManager in Starling

Hello, the image texture is automatically created in Starling when you use the AssetManager to load assets like PNGs. You should try using ATF files, they are way more performant on mobile.

So when you create your "spine-texture" from TexturePacker you will get a PNG file and the XML file that will load the image and all its parts. Like this:
spine-texture.png and say spine-xml.xml

The "spine-texture.png" is referenced inside the xml file and Starlings Assets Manager creates a texture called "spine-texture". Turn verbose = true for the AssetManager so you can see the name of the texture object.

TexturePacker will create something that will look like this in the XML

<?xml version="1.0" encoding="UTF-8"?>
<TextureAtlas imagePath="spine-texture.png">
    Subtextures deleted for brevity
</TextureAtlas>

Since I use the Spine for animation I only need the JSON file that has all the animations and states.

I create many Spine animations in my Starling app so I have a Utils class that returns any Spine skeleton I need. I have a Global reference to the asset manager once its loaded.

public static function getSkeletonAnimation(textureName : String, jsonName : String) : SkeletonAnimation
{
   var skeletonJSON : SkeletonJson = new SkeletonJson(new StarlingAtlasAttachmentLoader(Constants.ASSETS.getTextureAtlas(textureName)));
   var skeletonData : SkeletonData = skeletonJSON.readSkeletonData(Constants.ASSETS.getObject(jsonName));
   var stateData : AnimationStateData = new AnimationStateData(skeletonData);
   var skeleton : SkeletonAnimation = new SkeletonAnimation(skeletonData, true, stateData);

   return skeleton;
}

I hope this helps!. It took me a few tries before I got Spine assets loading with Starlings Asset Manager. Once you get it though its awesome!

Good luck and let me know if this works for you.

  • Patrick
Related Discussions
...

Happy I could help.
Starling/Spine users need to stick together. Haven't come across too many on these forums. 🙂

Good luck!
Patrick

I'm not sure I understand completely but you need to render particles to a sprite on the Starling stage. Thats simple right?
If it needs to be in between 2 different Spine animations my guess is you would need to render the Spine animations to separate Sprites so you can render the particle sprite in between.

I always render each Spine animation to a sprite container.
Hope that helps

  • P

right on! Some times it just takes another set of ears/eyes

  • P