Someone on a forum I go to said I shouldn't use Rectangle.intersects
for my collision detection, and I should use this algorithm instead:
boolean rectangleIntersects(float rect1x, float rect1y, float rect1w,
float rect1h, float rect2x, float rect2y,
float rect2w, float rect2h)
{
return (rect1x + rect1w >= rect2x &&
rect1y + rect1h >= rect2y &&
rect1x <= rect2x + rect2w &&
rect1y <= rect2y + rect2h);
}
But isn't the Rectangle.intersects
algorithm different, and better than this?