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
An addition to @Ankit's solution:
boolean areColliding(Circle c1, Circle c2){
center_distance = (x1-x2)^2 +(y1-y2)^2; //this is the distance between the centers of the two circles.
if((c1.r+c2.r)^2 < center_distance)
return false;
else
return true;
}
This just compares the squared distances. Result is the same, but no square root and huge performance benefit.