Prev: D09B Up: Map Next: D116
D0EC: Creature's missile has hit Maroc's shield/barrier
This causes the creature's missile to rebound off the shield at high speed. The diverted missile/bolt can even close open doors if it collides with a door handle.
creature missile rebounding of Maroc's protective barrier
Calculate the missile's new horizontal trajectory:
D0EC LD A,($EAC0) Maroc's horizontal (X-axis) screen position, in 4-pixel/half-character steps
D0EF LD C,A
D0F0 LD A,($EB48) Missile's horizontal (X-axis) screen position, in 4-pixel/half-character steps
D0F3 SUB C Subtract Maroc's position from missile position
D0F4 RLA
D0F5 SBC A,A The RLA and SBC sets A to 0 or 255 depending on whether the missile position is to Maroc's left or right
D0F6 XOR $0F Based on direction, sets the above calculated value at 240 (-15) or +15
D0F8 LD C,A
D0F9 LD A,($EB4C) Get the missile's existing horizontal movement speed
D0FC ADD A,C Add the calculated value (+/- 15)
D0FD LD ($EB4C),A ...and re-store.
Calculate the missile's new vertical trajectory
D100 LD A,($EAC1) Maroc's vertical (Y-axis) pixel screen position
D103 LD C,A Missile's vertical (X-axis) pixel screen position
D104 LD A,($EB4A)
D107 SUB C Subtract Maroc's position from missile position
D108 RLA
D109 SBC A,A The RLA and SBC sets A to 0 or 255 depending on whether the missile position is above or below Maroc
D10A XOR $0F Based on direction, sets the above calculated value at 240 (-15) or +15
D10C LD C,A
D10D LD A,($EB4D) Get the missile's existing vertical movement speed
D110 ADD A,C Add the calculated value (+/- 15)
D111 LD ($EB4D),A ...and re-store.
D114 JR $D12E
Prev: D09B Up: Map Next: D116