![]() |
Routines |
| Prev: 46841 | Up: Map | Next: 46956 |
|
Handles the top half of a guard that patrols east and west. The guard walks at a speed of 2 and turns round when it hits something. The bottom half of the guard, which is the next object in the table, is kept in step.
|
||||||||
|
Walk east or west and turn when the guard hits something.
|
||||||||
| HandleGuardMovingEastWest | 46908 | CALL SetPixelAdjustments_Guard | Set the pixel adjustments of a guard. | |||||
| 46911 | BIT 0,(IX+13) | Test whether the guard is heading east. | ||||||
| 46915 | LD A,2 | Set the speed to 2. | ||||||
| 46917 | JR NZ,HandleGuardMovingEastWest_Speed | Jump to HandleGuardMovingEastWest_Speed if the guard is heading east. | ||||||
| 46919 | NEG | Make the speed negative. | ||||||
| HandleGuardMovingEastWest_Speed | 46921 | LD (IX+9),A | Set the speed in X of the guard. | |||||
| 46924 | LD (IX+41),A | Set the speed in X of the bottom half of the guard too. | ||||||
| 46927 | CALL FaceDirectionOfMovement | Choose the graphic of the guard from its direction. | ||||||
| 46930 | CALL ApplyGravityAndMove | Apply gravity to the guard and move it. | ||||||
| 46933 | BIT 0,(IX+12) | Jump to HandleGuardMovingEastWest_BottomHalf if the guard has not hit something along the X axis. | ||||||
| 46937 | JR Z,HandleGuardMovingEastWest_BottomHalf | |||||||
| 46939 | LD A,(IX+13) | Fetch the direction flags of the guard. | ||||||
| 46942 | XOR %00000001 | Turn the guard round. | ||||||
| 46944 | LD (IX+13),A | Store them. | ||||||
|
Keep the bottom half in step and make the guard deadly.
|
||||||||
| HandleGuardMovingEastWest_BottomHalf | 46947 | LD A,(IX+1) | Fetch the X coordinate of the guard. | |||||
| 46950 | LD (IX+33),A | Give it to the bottom half of the guard. | ||||||
| 46953 | JP SetDeadlyFlagsAndDraw | Make the guard deadly and flag it to be drawn again. | ||||||
| Prev: 46841 | Up: Map | Next: 46956 |