[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

All GELs, including VSprites, can participate in the software collision
detection features of the graphics library.  Simple Sprites must use
hardware collision detection.  See the Amiga Hardware Reference Manual for
information about hardware collision detection.

Two kinds of collisions are handled by the system routines:
GEL-to-boundary hits and GEL-to-GEL hits.  You can set up as many as 16
different routines to handle different collision combinations; one routine
to handle the boundary hits, and up to fifteen more to handle different
inter-GEL hits.

You supply the actual collision handling routines, and provide their
addresses to the system so that it can call them as needed (when the hits
are detected).  These addresses are kept in a collision handler table
pointed to by the CollHandler field of the GelsInfo list.  Which routine
is called depends on the 16-bit MeMask and HitMask members of the VSprite
structures involved in the collision.

When you call DoCollision(), the system goes through the GelsInfo list
which, is constantly kept sorted by x, y position.  If a GEL intersects
the display boundaries and the GELs HitMask indicates it is appropriate,
the boundary collision routine is called.  When DoCollision() finds that
two GELs overlap, it compares the MeMask of one with the HitMask of the
other.  If corresponding bits are set in both, it calls the appropriate
inter-GEL collision routine at the table position corresponding to the
bits in the HitMask and MeMask, as outlined below.

 Preparing for Collision Detection         VSprite BorderLine 
 Building a Table of Collision Routines    VSprite HitMask and MeMask 
 VSprite Collision Mask                    Using HitMask and MeMask