![]() |
Routines |
| Prev: 45468 | Up: Map | Next: 45541 |
|
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 | 45486 | LD A,(IX+9) | Return if the mouse is not moving. | |||||
| 45489 | OR (IX+10) | |||||||
| 45492 | RET Z | |||||||
| 45493 | LD A,(IX+9) | Fetch the speed along the x axis. | ||||||
| 45496 | CP (IX+10) | Jump to FaceDirectionOfMovement_MovingAlongY if the mouse is moving along the y axis. | ||||||
| 45499 | JR C,FaceDirectionOfMovement_MovingAlongY | |||||||
| 45501 | BIT 7,A | Jump to FaceDirectionOfMovement_West if the mouse is moving west. | ||||||
| 45503 | JR NZ,FaceDirectionOfMovement_West | |||||||
| 45505 | SET 0,(IX+0) | Set bit 0 of the sprite number. | ||||||
| FaceDirectionOfMovement_Unflip | 45509 | RES 6,(IX+7) | Reset bit 6 of the flags. | |||||
| 45513 | RET | Return. | ||||||
|
The mouse is moving west.
|
||||||||
| FaceDirectionOfMovement_West | 45514 | RES 0,(IX+0) | Reset bit 0 of the sprite number. | |||||
| 45518 | JR FaceDirectionOfMovement_Unflip | Jump to FaceDirectionOfMovement_Unflip. | ||||||
|
The mouse is moving along the y axis.
|
||||||||
| FaceDirectionOfMovement_MovingAlongY | 45520 | BIT 7,(IX+10) | Jump to FaceDirectionOfMovement_North if the mouse is moving north. | |||||
| 45524 | JR Z,FaceDirectionOfMovement_North | |||||||
| 45526 | SET 0,(IX+0) | Set bit 0 of the sprite number. | ||||||
| FaceDirectionOfMovement_Flip | 45530 | SET 6,(IX+7) | Set bit 6 of the flags. | |||||
| 45534 | RET | Return. | ||||||
|
The mouse is moving north.
|
||||||||
| FaceDirectionOfMovement_North | 45535 | RES 0,(IX+0) | Reset bit 0 of the sprite number. | |||||
| 45539 | JR FaceDirectionOfMovement_Flip | Jump to FaceDirectionOfMovement_Flip. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 45468 | Up: Map | Next: 45541 |