SyntaxBomb - Indie Coders
Languages & Coding => Others => Topic started by: bplus on November 14, 2019, 18:31:43
Piece of cake!
FUNCTION collision% (b1x, b1y, b1w, b1h, b2x, b2y, b2w, b2h)
' x, y represent the box left most x and top most y
' w, h represent the box width and height which is the usual way sprites / tiles / images are described
' such that boxbottom = by + bh
' and boxright = bx + bw
IF (b1y + b1h < b2y) OR (b1y > b2y + b2h) OR (b1x > b2x + b2w) OR (b1x + b1w < b2x) THEN
collision% = 0
ELSE
collision% = 1
END IF
END FUNCTION
Two circles even easier!