Well its a simple enough case to write your own code.
If you have rect1 and want to know if it interesects rect2, where each rect is something like { x=, y=, width=, height= } you’d basically do like (psuedo code, but might work if I’m lucky!):
if rect1.x + rect1.width \>= rect2.x then
if rect1.x \<= rect2.x + rect2.width then
if rect1.y + rect1.height \>= rect2.y then
if rect1.y \<= rect2.y + rect2.height then
print("collision!")
end
end
end
endYou could roll all the conditionals into a single line, but I don’t really see the point.
If you want to do lots and lots of collisions simultaneously you could break the screen down into a grid and only do the above test if both rects are in close-by grid cells, but that’s an optimisation problem rather than out and out collision testing. [import]uid: 46639 topic_id: 9877 reply_id: 36011[/import]