I'm trying to use a Spine animation with Starling and the spine-starling runtime. I think my export is not setup correctly (maybe the json file) or maybe I am doing something wrong in AS3, as when I run the animation in my game, all the bones are in the wrong place making the character (actually a box built with pieces/bones) a jumble of pieces and the animation doesn't look like it does when I run it in Spine.
In Game.as:
// -- Blue Explosion
[Embed(source = "../assets/blue_game_piece_explosion/blue_game_piece_exp.json", mimeType = "application/octet-stream")]
static public const BlueExpJSON : Class;
[Embed(source = "../assets/blue_game_piece_explosion/blue_game_piece_exp.atlas", mimeType = "application/octet-stream")]
static public const BlueExpAtlas : Class;
[Embed(source = "../assets/blue_game_piece_explosion/blue_game_piece_exp.png")]
static public const BlueExpAtlasTexture : Class;
BlueExplosionAtlas = new BlueExpAtlas();
BlueExplosionAtlasTexture = new BlueExpAtlasTexture();
BlueExplosionJSON = new BlueExpJSON();
Loading the json once:
var attachment_loader:AtlasAttachmentLoader;
var atlas:Atlas;
var json:SkeletonJson;
var explosion:SkeletonAnimation;
// Use blue explosion
atlas = new Atlas(BlueExplosionAtlas, new StarlingTextureLoader(BlueExplosionAtlasTexture));
attachment_loader = new AtlasAttachmentLoader(atlas);
json = new SkeletonJson(attachment_loader);
json.scale = 1;
BlueExplosionData = json.readSkeletonData(BlueExplosionJSON);
Then, making the explosion of the box/piece:
Color = color;
switch(Color)
{
case ColorBlue:
_explosion = new SkeletonAnimation(BlueExplosionData);
_explosion.state.setAnimationByName(0, "explode", false);
break;
}
if (_explosion == null) return;
_explosion.x = x;
_explosion.y = y;
_explosion.scale = 1;
_explosion.state.timeScale = 0.01;
//_explosion.state.update(0.25);
//_explosion.state.apply(_explosion.skeleton);
//_explosion.twoColorTint = true;
//_explosion.skeleton.updateWorldTransform();
GameScene.addChild(_explosion);
GameJuggler.add(_explosion);
Any help would be awesome! Thanks.