Prev: 36804 Up: Map Next: 36875
36810: 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 36810 LD D,(IY+25) Fetch the horizontal speed of the player into DE.
36813 LD E,(IY+26)
36816 LD H,(IX+7) Fetch the horizontal speed of the object into HL.
36819 LD L,(IX+8)
36822 SRA H Halve it.
36824 RR L
36826 CALL NegateNumber Negate it.
36829 LD (IX+7),H Store it as the new speed of the object.
36832 LD (IX+8),L
36835 ADD HL,DE Add the speed of the player.
36836 LD (IY+25),H Store the result as the new speed of the player.
36839 LD (IY+26),L
36842 LD D,(IY+27) Fetch the vertical speed of the player into DE.
36845 LD E,(IY+28)
36848 LD H,(IX+9) Fetch the vertical speed of the object into HL.
36851 LD L,(IX+10)
36854 SRA H Halve it.
36856 RR L
36858 CALL NegateNumber Negate it.
36861 LD (IX+9),H Store it as the new speed of the object.
36864 LD (IX+10),L
36867 ADD HL,DE Add the speed of the player.
36868 LD (IY+27),H Store the result as the new speed of the player.
36871 LD (IY+28),L
36874 RET Return.
Prev: 36804 Up: Map Next: 36875