loops Posted November 14, 2013 Share Posted November 14, 2013 I have a sprite that I would like to follow another sprite, so I have added it as a child. The parent sprite is then added to a group. When I forEach over the group, the child sprite shows up as an element. Looking through the code, it looks like the addChild call results in the list flattening by adding the child as the next element to the parent instead of creating a tree. Is this intended? The idea is to have a health bar following a character. When I process the characters, I don't want to also be processing the health bars. Is there another mechanism by which this is accomplished? Link to comment Share on other sites More sharing options...
loops Posted November 19, 2013 Author Share Posted November 19, 2013 Suggestions? Link to comment Share on other sites More sharing options...
Cameron Foale Posted November 20, 2013 Share Posted November 20, 2013 A dumb temporary way: don't use Group.forEach, but instead loop over the children by using the `myGroup._container.children` array. The Phaser.Group iterate function uses the renderer's linked list to loop through. Link to comment Share on other sites More sharing options...
Recommended Posts