Prev: 75ed Up: Map Next: 7638
75fc: Vertical platform collision detection for Jetman/Aliens.
Used by the routine at 75d1.
Input
A Sprite X position.
E Collision state on entry.
HL Address of platform object.
IX Jetman/Alien object.
Output
E Collision state. Bit: 7=landed, 4=hits head, 3=?, 2=?.
75fc inc hl Platform Y location
75fd inc hl Platform width
75fe cp (hl) X position >= width (no collision) so try next platform
75ff jp nc,$7630
7602 add a,$12
7604 cp (hl) Set bit 3 if collision: X position >= width
7605 jp c,$760a
7608 set 3,e
760a dec hl Platform Y location
760b ld a,(hl) A=platform Y position
760c sub (ix+$02) Subtract sprite Y position
760f neg
7611 inc a Add 2
7612 inc a
7613 jp m,$7630 Next platform if no collision: Y position is negative
7616 cp $02 A < 2, Landed on platform
7618 jr c,$762c
761a cp (ix+$07) A < sprite height, hits underneath of platform?
761d jr c,$7628
761f dec a Subtract 2
7620 dec a
7621 cp (ix+$07) Next platform if no collision: Y position >= sprite height
7624 jr nc,$7630
Jetman hits the bottom of a platform
7626 set 4,e
7628 set 2,e Set bit-2 (4) <- Jetman is leaving a platform?
762a pop hl Set HL back to beginning of platform object
762b ret
762c set 7,e Bit-7 indicates landing on a platform
762e jr $7628
7630 pop hl Set HL back to beginning of platform object
7631 inc hl Increment HL until is points to the start of the next platform sprite
7632 inc hl
7633 inc hl
7634 inc hl
7635 djnz $75ed Loop back until all 4 platforms have been checked
7637 ret
Prev: 75ed Up: Map Next: 7638