Re: Collision Detection
- Posted by gaz Aug 09, 2009
- 1084 views
This is a boundbox collision detection function
The first two arguments are the first image x and y positions and
the next two arguments are the width and height of the first image. and
the next four arguments are the x and y position and width and height of the second image.
function check_bb_collision_general(integer x1,integer y1,integer w1,integer h1,integer x2,integer y2,integer w2,integer h2) if not (((x1)>=(x2)+(w2)) or ((x2)>=(x1)+(w1)) or ((y1)>=(y2)+(h2)) or ((y2)>=(y1)+(h1))) then return 1 end if return 0 end function
The function returns true or 1 if the boundboxs are overlaping