You dont need a website, all you need is a brain, and a bit of thought!
This is the problem with so many programmers these days. If they have a problem, the first thing they do is jump on the web and ask someone to show them how to do it rather than having a go at doing it themselves. My advice, if you want to learn and become good at what you do, sit down and think about it for a while, and then try and do it yourself.
However, I am feeling cheerful this morning and I will give you a few pointers.
If you already know the bounding rectangles of the objects, then you know all you need to know already! You just need to perform a few simple tests (this method i'm describing is designed to help you think, not to give you the most elegant and efficient solution straight up).
First, test to see if the location of the left hand side of the rectangle of the first object is less than or equal to the right hand side of the rectangle of the second object, and that the right hand side of the first rectangle is greater than or equal to the left hand side of the second. If it is then we have a possible overlap/collision. You then just need to test if the top of the first rectangle is higher or equal to the bottom of the second, and that the bottom of the first rectangle is higher or equal to the top of the first. Here is example code:
Code:
RECT obj1, obj2;
if((obj1.left <= obj2.right && obj1.right >= obj2.left) || (obj1.right >= obj2.left && obj1.left <= obj2.right))
{
if(obj1.top <= obj2.bottom && obj1.bottom >= obj2.top)
{
// BOOM! We have a collision
}
}
Alternatively, if you have two RECT structures filled out, you could use the Windows API function IntersectRect(). This function actually creates a rectangle from the intersection of 2 other rectangles, but returns FALSE if the rectangles dont intersect (ie. dont collide).
I hope this helps. And next time, put some thought into it yourself!
Good luck!
U.