An easy way to do collisions?

Monkey Forums/Monkey Programming/An easy way to do collisions?

pipo-kun(Posted 2011) [#1]
I need to check collisions between sprites and for the GUI buttons.

AFAIK Monkey don't have them in the API, do you guys know a fast way to achieve them?

I'm looking at the Blitzmax forums, maybe can get some ideas..


therevills(Posted 2011) [#2]
RectsOverlap?

Function RectsOverlap:Int(x0:Float, y0:Float, w0:Float, h0:Float, x2:Float, y2:Float, w2:Float, h2:Float)
 	If x0 > (x2 + w2) Or (x0 + w0) < x2 Then Return False
 	If y0 > (y2 + h2) Or (y0 + h0) < y2 Then Return False
	Return True
End 



Xaron(Posted 2011) [#3]
What GUI buttons do you mean?


pipo-kun(Posted 2011) [#4]
Sorry, I meant GUI buttons made from bitmap.. Just 2D Graphics..

RectsOverlap could be fine, thx! :)