Prev: 47266 Up: Map Next: 47308
47287: 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 47287 LD A,(IX+5) Fetch the depth of the first object.
47290 ADD A,(IY+5) Add the depth of the second object.
47293 LD D,A Copy the total to D.
Work out the distance between the centres, once the first has moved.
47294 LD A,(IX+2) Fetch the y position of the first object.
47297 ADD A,L Add L.
47298 SUB (IY+2) Subtract the y position of the second object.
47301 JP P,TestOverlapInY_Compare Jump to TestOverlapInY_Compare if the distance is positive.
47304 NEG Negate A.
TestOverlapInY_Compare 47306 SUB D Subtract D.
47307 RET Return.
View the equivalent code in;
Prev: 47266 Up: Map Next: 47308