[comp.sys.amiga] collision detection

jojo@astroatc.UUCP (Jon Wesener) (03/10/88)

	I'm finally learning how to use bobs and vsprites and remember
seeing postings saying something like the collision detection doesn't
work in all directions.  Would someone tell me the scoop on this?

	2ndly, I'll have periodic questions and would like it if someone
with bob, sprite and screen experience would let me ask them questions
directly via e-mail, rather than through net postings.  The signal to
noise ratio in this group is astounding.

Thanx in advance,
--j
-- 
jon wesener
... {seismo | harvard | ihnp4} ! {uwvax | cs.wisc.edu} ! astroatc!jojo

".. But its when you realize what you're doing that you despise it .."

cs178abu@sdcc8.ucsd.EDU (John Schultz) (03/11/88)

  The hardware collision registers work only for certain pairs of
hardware sprites.  I have written a few games for the Amiga, and
don't use the system animation routines; they are too slow.  In
"Libyans In Space" I used a simple "proximity" algorithm for
animation done using BltBitMap().  In "TacoRama!" (soon to be
released), I used hardware sprites and used the hardware collsion
registers.  TacoRama! was simple enough to allow me to choose the
pairs that would work for hardware collisions.  The runtime overhead
for algorithmic collision detection is quite small.  I would
recommend using that approach for anything sufficiently complex
(more than the hardware registers can handle).  Here is the simple
algorithm I use:

PROCEDURE proximity(targetx,targety,
                    missilex,missiley : INTEGER;
                    targetw,targeth   : CARDINAL): BOOLEAN;
BEGIN
  RETURN (ABS(targetx - missilex) < INTEGER(targetw)) 
     AND (ABS(targety - missiley) < INTEGER(targeth));
END proximity;



  John