home *** CD-ROM | disk | FTP | other *** search
- Collision Checking - for Amnesia 1.10
- =====================================
-
- This file describes the collision checking facilities within Amnesia.
-
- Overview
- --------
-
- Collision checking within games always places a high demand on computing
- power. If you check 50 objects to see if they are touching any of another 50
- objects, that’s 2,500 checks that need to be done!
-
- To cope with this sort of load Amnesia handles collision checking in a
- special way. When a table of objects is processed, the bounding boxes
- (rectangles which enclose an object just touching its edges) are stored in
- another table. When you need to collision check two sets of objects, Amnesia
- checks two of these tables against each other. This can be done very
- quickly.
-
- The three steps to collision checking
- -------------------------------------
-
- This is what you need to do to get collision checking working.
-
- (1) When you set up your tables using Amnesia_ClaimTable, you set bit 0 of
- R1. This reserves space for the tables of bounding boxes.
-
- (2) When you create your objects using Amnesia_MakeObject, you set bit 7 in
- the object’s flags.
-
- (3) Use the following code to do the checking.
-
- R0=1 ;table 1
- R1=2 ;with table 2
- REPEAT
- SYS "Amnesia_CollisionCheck",R0,R1 TO R0,R1
- IF R0<>0 THEN PROChit
- UNTIL R0=0
-
- This code would check table 1 against table 2. If there was a collision, it
- would call PROChit with R0 pointing to the object in table 1, and R1 pointing
- to the object in table 2.
-
- It is possible to collision check a table with itself. The BallBnc demo is a
- good example of this.
-
- ****************************************************
- This document is copyright A.Southgate 1994.
- It may be freely distibuted and copied but
- should not be modified, otherwise things will
- get very confusing.
- ****************************************************
-