azerion / phaser-spine

A plugin for Phaser 2 that adds Spine support
MIT License
121 stars 57 forks source link

Reusing spine atlas frames #51

Open lukz opened 7 years ago

lukz commented 7 years ago

Hi!

Is there any way to use spine atlas frames as Phaser images? I know there's atlas image loaded into cache and I can use it but it doesn't contain any frames.

AleBles commented 7 years ago

There's also an SpineCache available that contains Spine's .atlas file in which you should be able to extract the frame from.

You can access this with:

var atlasData = this.game.cache.getSpine(<spineName>).atlas;

You can check out spine.Atlas and spine.AtlasReader on how to extract data from this file

lukz commented 7 years ago

Does this.game.cache.getSpine(<spineName>).atlas; suppose to contain just a string?

lukz commented 7 years ago

I've managed to get in working. For people looking for similar solution this is what I did (basically rewrote createSpine fucntion):

https://gist.github.com/lukz/0867e9f1875f9771873fc540862e6179

spayton commented 6 years ago

where does addSpineCache() get called?