InteractivePie Posted June 23, 2015 Share Posted June 23, 2015 Dear community, I am trying to move my player object towards my mouse and am trying to achieve that if the player colllides with a group of sprites (stars) that the star in the group of stars is deleted. The thing is, I only want this to happen if the player entirely covers the star. Both stars and players use the P2JS physics. I wonder if this is needed. So I have 2 problems now. First I used arcade and i could easily move my player with the mouse. How can I do this in p2JS?Since Im now using p2JS because of circle colliders, how can i check if another circle (star) is within the larger circle (the player)? Link to comment Share on other sites More sharing options...
Tom Atom Posted June 25, 2015 Share Posted June 25, 2015 Hi, small circle is in large circle if distance between centers of both circles is less than difference of radii of both circles: pseudocode:dist = center_small - center_largeif (dist < radius_large - radius_small) { small is inside...} Link to comment Share on other sites More sharing options...
Recommended Posts