What if I told you that there is a simple box where collision between 2 rectangles takes place?
Dont believe me?
Take a look at this diagram.



Now do you agree that if the entire 'object 1' is *anywhere* inside of the green box, then it is colliding?
Well, its true. Yep. I'm not lying to ya.


So, I wrote a little function that detects it, heres the code:

code:
function CollisionBox(x1,y1,w1,h1,x2,y2,w2,h2)
return (x1 + w1 >= x2 and x1 <= x2 + w2 and y1 + h1 >= y2 and y1 <= y2 + h2)
end

Simply give it the x,y,width,height of your first object,
then then x,y,width,height of your second object.

Youre welcome.