Sanic Posted August 16, 2016 Share Posted August 16, 2016 I'm having trouble understanding how to use groups effectively... I'm trying to use them to move a bunch of sprites all at once. Say I have some player 1 sprites that move together and player 2 sprites that move together, and they're sitting on a platform that moves the platform sprites and the sprites of both players together... I want the platform to be relative to the canvas, and the players to be relative to the platform... but I can't put sprites in more than one group and groups don't apply stuff recursively... so what should I be doing? Link to comment Share on other sites More sharing options...
saltysquid Posted August 24, 2016 Share Posted August 24, 2016 I'm having this exact same issue. I'm trying to put health bars above enemies heads and have the bars follow them as they move. I hope you get some answers. Link to comment Share on other sites More sharing options...
samme Posted August 24, 2016 Share Posted August 24, 2016 Did you see http://phaser.io/examples/v2/groups/nested-groups ? Groups should move relative to all their ancestors when nested. @saltysquid, `enemySprite.addChild(heathBar);` should be enough for that. Link to comment Share on other sites More sharing options...
saltysquid Posted August 25, 2016 Share Posted August 25, 2016 Interesting! Thanks for the link, definitely going to check that out! Link to comment Share on other sites More sharing options...
Recommended Posts