![]() |
Routines |
| Prev: B19C | Up: Map | Next: B1E5 |
|
Used by the routine at HandleBouncingMouse.
Sets the way a robot mouse faces to match the direction in which it is moving, if it is moving along one axis. The way it faces is held in bit 0 of its sprite number and bit 6 of its flags (see TurnMouseOneWay).
|
||||||||
|
Face along the axis with the larger speed.
|
||||||||
| FaceDirectionOfMovement | B1AE | LD A,(IX+$09) | Return if the mouse is not moving. | |||||
| B1B1 | OR (IX+$0A) | |||||||
| B1B4 | RET Z | |||||||
| B1B5 | LD A,(IX+$09) | Fetch the speed along the x axis. | ||||||
| B1B8 | CP (IX+$0A) | Jump to FaceDirectionOfMovement_MovingAlongY if the mouse is moving along the y axis. | ||||||
| B1BB | JR C,FaceDirectionOfMovement_MovingAlongY | |||||||
| B1BD | BIT 7,A | Jump to FaceDirectionOfMovement_West if the mouse is moving west. | ||||||
| B1BF | JR NZ,FaceDirectionOfMovement_West | |||||||
| B1C1 | SET 0,(IX+$00) | Set bit 0 of the sprite number. | ||||||
| FaceDirectionOfMovement_Unflip | B1C5 | RES 6,(IX+$07) | Reset bit 6 of the flags. | |||||
| B1C9 | RET | Return. | ||||||
|
The mouse is moving west.
|
||||||||
| FaceDirectionOfMovement_West | B1CA | RES 0,(IX+$00) | Reset bit 0 of the sprite number. | |||||
| B1CE | JR FaceDirectionOfMovement_Unflip | Jump to FaceDirectionOfMovement_Unflip. | ||||||
|
The mouse is moving along the y axis.
|
||||||||
| FaceDirectionOfMovement_MovingAlongY | B1D0 | BIT 7,(IX+$0A) | Jump to FaceDirectionOfMovement_North if the mouse is moving north. | |||||
| B1D4 | JR Z,FaceDirectionOfMovement_North | |||||||
| B1D6 | SET 0,(IX+$00) | Set bit 0 of the sprite number. | ||||||
| FaceDirectionOfMovement_Flip | B1DA | SET 6,(IX+$07) | Set bit 6 of the flags. | |||||
| B1DE | RET | Return. | ||||||
|
The mouse is moving north.
|
||||||||
| FaceDirectionOfMovement_North | B1DF | RES 0,(IX+$00) | Reset bit 0 of the sprite number. | |||||
| B1E3 | JR FaceDirectionOfMovement_Flip | Jump to FaceDirectionOfMovement_Flip. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: B19C | Up: Map | Next: B1E5 |