Prev: 8FC4 Up: Map Next: 900B
8FCA: Bounce Ship
Used by the routine at ApplyCollisionEffects.
Bounces the player's ship off an object, by exchanging half of the speed of each of them.
Input
IX Address of the object that was hit
IY Address of the player's object
BounceShip 8FCA LD D,(IY+$19) Fetch the horizontal speed of the player into DE.
8FCD LD E,(IY+$1A)
8FD0 LD H,(IX+$07) Fetch the horizontal speed of the object into HL.
8FD3 LD L,(IX+$08)
8FD6 SRA H Halve it.
8FD8 RR L
8FDA CALL NegateNumber Negate it.
8FDD LD (IX+$07),H Store it as the new speed of the object.
8FE0 LD (IX+$08),L
8FE3 ADD HL,DE Add the speed of the player.
8FE4 LD (IY+$19),H Store the result as the new speed of the player.
8FE7 LD (IY+$1A),L
8FEA LD D,(IY+$1B) Fetch the vertical speed of the player into DE.
8FED LD E,(IY+$1C)
8FF0 LD H,(IX+$09) Fetch the vertical speed of the object into HL.
8FF3 LD L,(IX+$0A)
8FF6 SRA H Halve it.
8FF8 RR L
8FFA CALL NegateNumber Negate it.
8FFD LD (IX+$09),H Store it as the new speed of the object.
9000 LD (IX+$0A),L
9003 ADD HL,DE Add the speed of the player.
9004 LD (IY+$1B),H Store the result as the new speed of the player.
9007 LD (IY+$1C),L
900A RET Return.
Prev: 8FC4 Up: Map Next: 900B