Re: A86: Sprite hits sprite
[Prev][Next][Index][Thread]
Re: A86: Sprite hits sprite
>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
Follow-Ups:
References: