Re: A86: Sprite hits sprite


[Prev][Next][Index][Thread]

Re: A86: Sprite hits sprite




I might be visualizing this wrong, but if the distances between the X and Y
coords of the same corner on both sprites were less than 8 mean they were
touching:

if ( (abs(X1 - X2) < 8) && (abs(Y1 - Y2) < 8) )

At 06:57 PM 8/20/98 -0400, you wrote:
>
>>What would I put in my program to make it so that one sprite hits another
one
>>and adds to the score?  I know how to do the score part but the sprite
hitting
>>the other sprite part is unknown to me.
>>
>The easiest (and fastest) way to do it is to check if the 8x8 (or whatever)
>boxes the sprites are in overlap. You know, just do a check to see if any
>of the corners of one box are between the corners of the other box. There
>are only 4 cases, I think, so it's just 4 (or 8?) compares and conditional
>jumps.
>
>If you need pixel precision collision detection (i.e. you need to know if
>the pixels of the sprites actually hit), I have a nifty algorithm that goes
>after the box check and is pretty quick. I haven't written it up in Z80
>asm, but I could if you need it.
>
>--Joshua
>
>

--
David Phillips
mailto:electrum@tfs.net
ICQ: 13811951
AOL/AIM: Electrum32


References: