Prev: B8A2 Up: Map Next: B8CC
B8B7: Test Overlap In Y
Tests whether two objects overlap along y, once the first has moved by its new speed along y. They overlap when the distance between the y positions is smaller than the two depths added together.
Input
L New speed along y of the first object
IX The address of the first object
IY The address of the second object
Output
F Carry flag set if the objects overlap
Compare the y distance with the depths.
TestOverlapInY B8B7 LD A,(IX+$05) Fetch the depth of the first object.
B8BA ADD A,(IY+$05) Add the depth of the second object.
B8BD LD D,A Copy the total to D.
Work out the distance between the centres, once the first has moved.
B8BE LD A,(IX+$02) Fetch the y position of the first object.
B8C1 ADD A,L Add L.
B8C2 SUB (IY+$02) Subtract the y position of the second object.
B8C5 JP P,TestOverlapInY_Compare Jump to TestOverlapInY_Compare if the distance is positive.
B8C8 NEG Negate A.
TestOverlapInY_Compare B8CA SUB D Subtract D.
B8CB RET Return.
View the equivalent code in;
Prev: B8A2 Up: Map Next: B8CC