DQBcollideOnLayer
FUNCTION

Prototype

DECLARE SUB DQBcollideOnLayer (BYVAL Layer, BYVAL x, BYVAL y, BYVAL SpriteSeg,
                               BYVAL SpriteOff)

Parameters

Layer - Layer where to test for collision(s)

x - x position of sprite

y - y position of sprite

SpriteSeg - Segment of sprite array (use VARSEG)

SpriteOff - Offset of sprite array (use VARPTR)

Returns

Pixel color of first colliding object, 0 on no collisions

Description

This function introduces the concept of "collisions layer": by using it, you can achieve fast collision detections between several sprites, in an easy way. By specifying a layer, and a sprite position and data, DQBcollideOnLayer returns the color of the first non-trasparent pixel on the layer, that actually collides with the specified sprite. If no collision is detected, 0 is returned.

Notes:

Sprite position can be inside as well as outside layer space (i.e. clipping is supported); It is suggested that you use DQBhPut to draw all your active sprites on the collision layer, so you can easily check for collisions using this function.