result=ImagesOverlap3D(sprite1,sprite2[,overlap1][,overlap2])

Parameters

sprite1 - Hande of existing sprite
sprite2 - Handle of existing sprite
overlap1 (optional) - Amount of overlap ( in pixels) allowed for sprite1 before collision occurs
overlap2 (optional) - Amount of overlap ( in pixels) allowed for sprite2 before collision occurs

Description

This function takes the rectangular areas occupied by two sprites and returns TRUE if they overlap.
The optional overlap1 and overlap2 parameters allow for a specified amount of tollerance before the sprites report back as collided.
This is given in pixels. For example, a value of 8 in overlap1 allows sprite1 to overlap sprite2 by 8 pixels before a collision is reported.

The collision check takes into account the handle (axis) of the sprites as well as their sizes automatically. It also works fine on sprites flipped with the FlipImage3D command.

Note1: This function does not work with rotated sprites
Note2: The transparency of the sprites is not taken into account.

Example

Include "Sprite Control.bb"

SpriteGraphics3D 640,480

sprite1=LoadImage3D("bat.bmp")
sprite2=LoadImage3D("ball.bmp")

DrawImage3D sprite1,Rand(600),Rand(400)
DrawImage3D sprite2,Rand(600),Rand(400)

RenderWorld

Text 10,10,"Colllision = "+ImagesOverlap3D(sprite1,sprite2)

Flip
WaitKey
End


Index