fire7side Posted September 21, 2015 Share Posted September 21, 2015 I only want to do collision on part of a group. Should I make another group or iterate through instead of just using the group to overlap? How do I make a group from part of an existing group? Link to comment Share on other sites More sharing options...
drhayes Posted September 21, 2015 Share Posted September 21, 2015 Don't call the collision methods on the entire group; only call it on the children of the group you want to actually collide. Link to comment Share on other sites More sharing options...
fire7side Posted September 21, 2015 Author Share Posted September 21, 2015 That's what I'm doing now, I was just wondering if it was slower gamewise to do it that way. I think I'll also create two groups at the beginning and see if it's different. The problem is when I do motion, I want to do all of them, but collision, not all of them. I was wondering if I could make the same sprite a member of two different groups, but didn't know how to do it exactly. You know, like make a group and then fill it with members of another group leaving some out. Link to comment Share on other sites More sharing options...
drhayes Posted September 22, 2015 Share Posted September 22, 2015 I don't think it'd be slower since that's what Phaser does when you call collide on a group anyway; eventually it becomes a for loop over the children. Sprites can only be members of one group. It has to do with how groups make up nodes in the scene graph so, logically, one sprite can't be drawn twice. I know Rich is working on separating the two concepts but we don't have it just yet. Link to comment Share on other sites More sharing options...
Recommended Posts