A86: detecting hits


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

A86: detecting hits




here is my routine to check if 2 8x8 sprites are
hitting

CheckSpriteHit:
;returns nc if sprites are in contact
	ld b,a
	add a,7
	cp d
	ret c
	sub 14
	ld b,a \ ld a,d \ ld d,b
	cp d
	ret c
	ld a,c
	add a,7
	cp e
	ret c
	sub 14
	ld b,a \ ld a,e \ ld e,b
	cp e
	ret c
	ret


i am calling it like this

	ld a,(px)
	ld b,a
	ld a,(py)
	ld c,a
	ld a,(tx)
	ld d,a
	ld a,(ty)
	ld e,a
	call CheckSpriteHit
	ret  c
	call ClearTarget
	inc_(score)
	call UpDateTop
	call PickTarget
	ret
but it does not work all the time!!!
any ideas why? i will try debugging it later but want
to make sure the logic is right


__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com


Follow-Ups: