Prev: 43252 Up: Map Next: 43541
43521: Bounce Horizontally
Used by the routine at CheckMapObjectCollisions.
Makes the ship rebound after hitting something to its left or right: the horizontal speed of the ship is reversed and halved by ReverseAndHalveSpeed, and the horizontal scroll speed is negated.
BounceHorizontally 43521 PUSH HL Stash HL on the stack.
43522 LD HL,(51436) Fetch the word at 51436 into HL.
43525 CALL ReverseAndHalveSpeed Call ReverseAndHalveSpeed.
43528 LD (51436),HL Update the high byte of the ship's horizontal speed.
43531 POP HL Bring HL back off the stack.
43532 LD A,(52411) The horizontal scroll speed.
43535 NEG Negate A.
43537 LD (52411),A Update the horizontal scroll speed.
43540 RET Return.
Prev: 43252 Up: Map Next: 43541