GLBasic User Manual

Main sections

BOXCOLL

col% = BOXCOLL(xa%, ya%, sxa%, sya%, xb%, yb%, sxb%, syb%)



Checks if the rectangle with corner xa%, ya% and the size sxa%, sya% is colliding with the rectange with corner xb%, yb% and the size sxb%, syb%. If so, col% will be TRUE, otherwise it will be FALSE.

Sample:
 
start:
MOUSESTATE mx, my, ba, bb
PRINT "X", 100, 100
PRINT "H", mx, my
IF BOXCOLL( mx, my, 16, 16, 100, 100, 16, 16)
PRINT "!!!", 100, 150
ENDIF
SHOWSCREEN
GOTO start

See also...