Prev: B108 Up: Map Next: B165
B110: Handle Bouncing Mouse
The handler for the robot mice (objects 56 and 57) which run to and fro along one axis. A mouse which is not moving is given a speed from the way it faces, doubled. When it is blocked it reverses its speed, makes a noise and turns to face the other way.
Input
IX The address of the object
Move along the x axis, and reverse if blocked.
HandleBouncingMouse B110 CALL SetPixelAdjustments_Mouse Call SetPixelAdjustments_Mouse.
B113 CALL ExtendObjectDownwards Call ExtendObjectDownwards.
HandleBouncingMouse_Move B116 LD A,(IX+$09) Fetch the speed along the x axis.
B119 AND A Jump to HandleBouncingMouse_MoveAlongY if it is zero.
B11A JR Z,HandleBouncingMouse_MoveAlongY
B11C LD (IX+$10),A Remember the speed.
B11F CALL ApplyGravityAndMove Call ApplyGravityAndMove.
B122 BIT 0,(IX+$0C) Jump to HandleBouncingMouse_Finish if the mouse has not been blocked along the x axis.
B126 JR Z,HandleBouncingMouse_Finish
B128 LD A,(IX+$10) Fetch the speed which was remembered.
B12B NEG Make the speed negative.
B12D LD (IX+$09),A Set the speed along the x axis.
HandleBouncingMouse_Bounce B130 CALL PlayBumpSound Call PlayBumpSound.
B133 CALL FaceDirectionOfMovement Call FaceDirectionOfMovement.
HandleBouncingMouse_Finish B136 CALL RestoreObjectHeight Call RestoreObjectHeight.
B139 JP SetDeadlyFlagsAndDraw Jump to SetDeadlyFlagsAndDraw.
Move along the y axis, and reverse if blocked.
HandleBouncingMouse_MoveAlongY B13C LD A,(IX+$0A) Fetch the speed along the y axis.
B13F AND A Jump to HandleBouncingMouse_StartMoving if it is zero.
B140 JR Z,HandleBouncingMouse_StartMoving
B142 LD (IX+$10),A Remember the speed.
B145 CALL ApplyGravityAndMove Call ApplyGravityAndMove.
B148 BIT 1,(IX+$0C) Jump to HandleBouncingMouse_Finish if the mouse has not been blocked along the y axis.
B14C JR Z,HandleBouncingMouse_Finish
B14E LD A,(IX+$10) Fetch the speed which was remembered.
B151 NEG Make the speed negative.
B153 LD (IX+$0A),A Set the speed along the y axis.
B156 JR HandleBouncingMouse_Bounce Jump to HandleBouncingMouse_Bounce.
The mouse is not moving.
HandleBouncingMouse_StartMoving B158 CALL SetMouseSpeed Call SetMouseSpeed.
B15B SLA (IX+$09) Double the speed along the x axis.
B15F SLA (IX+$0A) Double the speed along the y axis.
B163 JR HandleBouncingMouse_Move Jump to HandleBouncingMouse_Move.
Prev: B108 Up: Map Next: B165