Re: A86: Re: collisions


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

Re: A86: Re: collisions




Umm...you call this routine with the coords of your two sprites loaded into
BC and DE.  If the carry flag is clear (no carry), then they are colliding
(assuming 8x8 sprites).  If the carry flag is set (carry), then they aren't
colliding.

> could some one let me know whats going on in this procedure?  i dont
> understand any of it :(  where do I stick this in my code?  after it draws
> the sprites?  how does it know what sprites it is looking at for the
> collision?
>
> > ; bc = (x1,y1), de = (x2,y2)
> >  ; returns: no carry = collision
> >  CheckCollision:
> >   ld a,d
> >   add a,7
> >   cp b
> >   ret c
> >   ld a,b
> >   add a,7
> >   cp d
> >   ret c
> >   ld a,e
> >   add a,7
> >   cp c
> >   ret c
> >   ld a,c
> >   add a,7
> >   cp e
> >   ret




References: