azerion / phaser-spine

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

Phaser Group support? #10

Closed shibekin69 closed 7 years ago

shibekin69 commented 7 years ago

Hi!

Just wondering if we can use Phaser's groups to organize where the spine animation will appear in our games? (Using groups to organize Z-layer of the different aspect of the game like the BG, stage, player, GUI, etc...)

I can see that this extends Phaser.Group. What if we already have our groups defined ahead of time, how do we make sure that our Spine animations are running on the group 'layer' we want?

For example: If I have 3 layer groups: BG, LEVEL, and UI, and I initialize them at the start of the game. How do I add Spine objects later on so that they're in between LEVEL and UI?

UI
    <---- Want to insert the Spine animation here
LEVEL
BG
shibekin69 commented 7 years ago

Ok, I figured it out. Basically, I can add the spine object to a group using something like:

players.add(spineobject);

Assuming players is a group.