Prev: 843C Up: Map Next: 8491
8470: Check to see if Wally is colliding with another sprite.
Input
B Amount to decrease wally's energy by.
HL Position of other sprite (Y, X).
Output
Wally_HitTest 8470 LD A,(DeathFlag) Check to see if wally is dead, if so return.
8473 OR A
8474 RET NZ
8475 LD DE,(Wally_X)
8479 LD A,L See if X pos is within range of sprite's X => (Wx-$10 > Sx < Wx+$10)
847A SUB E
847B SUB $0D
847D CP $E6
847F RET C
8480 LD A,H See if Y pos is within range of sprite's Y => (Wy-$10 > Sy < Wy+$10)
8481 SUB D
8482 SUB $1C
8484 CP $D6
8486 RET C
8487 PUSH IX Its a hit, so decrease energy and check for death.
8489 PUSH HL
848A CALL Milk_DecreaseByAmount
848D POP HL
848E POP IX
8490 RET
Prev: 843C Up: Map Next: 8491