collisions optimization

BlitzMax Forums/BlitzMax Beginners Area/collisions optimization

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

for 1) this ?

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

for 2 this ?
(stored for each sprite)

local radius# = sqr( ImageWidth(img)*ImageWidth+ImageHeight(Img)*Imageheight)


and for 3 ImagesCollide;-)