Re: A86: Re: sprites..
[Prev][Next][Index][Thread]
Re: A86: Re: sprites..
I pulled this routine from a project that's probably never going to be
released. You can probably optimize it, but it works just fine now. If
your sprites aren't 8x8, you'll have to change it...
; 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
> >alright. i figured out that i just wasnt clearing the screen after
drawing
> >a sprite moving up or down. now that i got this, i have another
question.
> >i want to put multiple sprites on the screen at one time. but how do i
> >know if one collides with another? how and where do i store the x&y
coords
> >for all sprites? thanks,
> >EklipZ
> >
> I think you're going to have to subtract the two x coords and see if
they're
> less than the width and do likewise w/ the y coords and the hight. I'm a
> beginner too so some one might have a better suggestion. It also seems to
me
> you need to read a few more tutorials.
References: