Prev: 8FC4 Up: Map Next: 900B
8FCA: Contact effect bit 4: bounce the object off the ship
Used by the routine at ship_contact.
Part of the default effect. For each axis the object's velocity is halved and negated, so it bounces away at half speed, and the same amount is added to the ship's velocity word in that axis (+$19, +$1B of its record).
Input
IX The object
IY The ship's record (ship_record)
contact_push 8FCA LD D,(IY+$19) X: the object's velocity becomes minus half of itself; the ship's has that added
8FCD LD E,(IY+$1A)
8FD0 LD H,(IX+$07)
8FD3 LD L,(IX+$08)
8FD6 SRA H
8FD8 RR L
8FDA CALL negate_hl
8FDD LD (IX+$07),H
8FE0 LD (IX+$08),L
8FE3 ADD HL,DE
8FE4 LD (IY+$19),H
8FE7 LD (IY+$1A),L
8FEA LD D,(IY+$1B) Y: the same
8FED LD E,(IY+$1C)
8FF0 LD H,(IX+$09)
8FF3 LD L,(IX+$0A)
8FF6 SRA H
8FF8 RR L
8FFA CALL negate_hl
8FFD LD (IX+$09),H
9000 LD (IX+$0A),L
9003 ADD HL,DE
9004 LD (IY+$1B),H
9007 LD (IY+$1C),L
900A RET
Prev: 8FC4 Up: Map Next: 900B