Bmax collisions

BlitzMax Forums/BlitzMax Programming/Bmax collisions

wildboar(Posted 2005) [#1]
Okay, I'm tired of searching, so now I'm asking... What commands are used in Blitzmax to test image collisions? Most of my searches find results for other flavors of Blitz that no longer work with BMax


Eikon(Posted 2005) [#2]
Max2D collision functions (documented in the manual):

ImagesCollide
ImagesCollide2
ResetCollisions
CollideImage
CollideRect

Here are two legacy functions for backward compatibility with old Blitz collision code.

Function RectsOverlap%(x0, y0, w0, h0, x2, y2, w2, h2)
	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 Function

Function ImageRectCollide%(image:TImage, ix%, iy%, iframe%, rx%, ry%, rwidth%, rheight%)

   ResetCollisions
   CollideImage image, ix, iy, iframe, 0, 1
   
   If CollideRect(rx, ry, rwidth, rheight, 1, 0) Then Return True Else Return False

End Function



klepto2(Posted 2005) [#3]
Well I doesn't program much 2d but i think you search for this :

ImageCollide and Imagecollide2

At least have a look in the docs.

Edit:

Too slow!