I\'m developing a Java game (but the dev. language doesn\'t really matter) including rounded objects like balls or pucks, and now working on collisions. I use a timer, so o
As you mentioned that the implementation language does not matter, I will give you a generic solution for detecting collision of round objects.
Also, from what I gather, all the objects in the scene are circles. The solution below does not apply for detecting collision between a circle and some other shape.
Suppose you have two circles c1 and c2. Suppose the corresponding radii are c1.r and c2.r, and the centers are (c1.x,c1.y) and (c2.x, c2.y), then the following function will tell whether c1 and c2 are in collision
boolean areColliding(Circle c1, Circle c2){
center_distance = sqrt((x1-x2)^2 +(y1-y2)^2); //this is the distance between the centers of the two circles.
if((c1.r+c2.r) < center_distance)
return false;
else
return true;
}
This pseudo-code function will return true if the circles are colliding, false otherwise.
Basically, what the function does is check whether the distance between the centers of the circles is greater than the sum of their respective radius.