![]() |
Routines |
| Prev: 34726 | Up: Map | Next: 34914 |
|
Used by the routines at HandlerMummy, HandlerDracula, HandlerFrankenstein, HandlerDevil and HandlerHunchback.
Sets the velocities of a creature so that it heads towards a target position, which is one pixel per step on each axis (or nothing on an axis where it has already arrived). Bit 0 of C is set if the creature is at the Y position of the target and bit 1 is set if it is at the X position, so C is 3 when it has arrived.
|
||||||||||||||
| SteerCreature | 34861 | LD C,0 | Clear the result in C, which flags which axes have been reached. | |||||||||||
| 34863 | LD A,D | Fetch the target Y position. | ||||||||||||
| 34864 | CP (IX+4) | Compare the target Y position with the Y position of the creature. | ||||||||||||
| 34867 | JR Z,SteerCreature_SameY | Jump to SteerCreature_SameY if they are the same. | ||||||||||||
| 34869 | JR NC,SteerCreature_Below | |||||||||||||
| 34871 | LD (IX+9),255 | Set the Y velocity of the creature to -1 (the target is above). | ||||||||||||
| SteerCreature_X | 34875 | LD A,E | Fetch the target X position. | |||||||||||
| 34876 | CP (IX+3) | Compare the target X position with the X position of the creature. | ||||||||||||
| 34879 | JR Z,SteerCreature_SameX | Jump to SteerCreature_SameX if they are the same. | ||||||||||||
| 34881 | JR NC,SteerCreature_Right | |||||||||||||
| 34883 | LD (IX+8),255 | Set the X velocity of the creature to -1 (the target is to the left). | ||||||||||||
| 34887 | RET | Return. | ||||||||||||
| SteerCreature_SameY | 34888 | LD (IX+9),0 | Set the Y velocity of the creature to 0. | |||||||||||
| 34892 | SET 0,C | Flag that the creature is at the target Y position. | ||||||||||||
| 34894 | JR SteerCreature_X | Jump to SteerCreature_X to work out the X velocity. | ||||||||||||
| SteerCreature_Below | 34896 | LD (IX+9),1 | Set the Y velocity of the creature to 1. | |||||||||||
| 34900 | JR SteerCreature_X | Jump to SteerCreature_X to work out the X velocity. | ||||||||||||
| SteerCreature_SameX | 34902 | LD (IX+8),0 | Set the X velocity of the creature to 0. | |||||||||||
| 34906 | SET 1,C | Flag that the creature is at the target X position. | ||||||||||||
| 34908 | RET | Return. | ||||||||||||
| SteerCreature_Right | 34909 | LD (IX+8),1 | Set the X velocity of the creature to 1. | |||||||||||
| 34913 | RET | Return. | ||||||||||||
| Prev: 34726 | Up: Map | Next: 34914 |