ForgeableSum Posted January 25, 2015 Share Posted January 25, 2015 EDIT: I should reword the title. It should say: trying to loop through children's children of group. So I'm trying to determine if sprites in a group are in range of each other. When the sprites get in range, they automatically attack each other. I figured the best way to do this would be to create an invisible sprite, add it as a child of each sprite, then check for overlap in the update function. I could then do a callback function on all overlapping bodies, having the parent of one overlapping body attack the other. Seems simple, in concept. But I haven't figured out a way to perform overlaps on just the invisible children of the sprites in the group. In other words, I'm trying to do something like this: if (game.physics.arcade.overlap(spriteGroup)) {console.log('overlaps'); } But instead of checking overlap on the children of group "spriteGroup," I want to check overlap on the children's children of spriteGroup. Because the bodies I want to check for overlap are children of the sprites in spriteGroup. Any suggestions? Link to comment Share on other sites More sharing options...
Recommended Posts