![]() |
Routines |
| Prev: D07B | Up: Map | Next: D0AC |
|
Used by the routines at RunPentagramStone and RunHelper.
Sets the speeds of an object along x and y to one in the direction that takes it towards a target, or to nothing if it is already in line with the target on an axis. The target is held at 15 and 16 of the record.
|
||||||||
|
Set the speed along x towards the target.
|
||||||||
| SteerTowardsTarget | D085 | LD A,(IX+$01) | Fetch the x position of the object. | |||||
| D088 | CP (IX+$15) | Jump to SteerTowardsTarget_Y if it is the same as the target. | ||||||
| D08B | JR Z,SteerTowardsTarget_Y | |||||||
| D08D | JR C,SteerTowardsTarget_X | Jump to SteerTowardsTarget_X if it is lower. | ||||||
| D08F | LD (IX+$09),$FF | Set the speed along x to FF. | ||||||
| D093 | JR SteerTowardsTarget_Y | Jump to SteerTowardsTarget_Y. | ||||||
| SteerTowardsTarget_X | D095 | LD (IX+$09),$01 | Set the speed along x to 01. | |||||
|
Set the speed along y towards the target.
|
||||||||
| SteerTowardsTarget_Y | D099 | LD A,(IX+$02) | Fetch the y position of the object. | |||||
| D09C | CP (IX+$16) | Return if it is the same as the target. | ||||||
| D09F | RET Z | |||||||
| D0A0 | JR C,SteerTowardsTarget_UpY | Jump to SteerTowardsTarget_UpY if it is lower. | ||||||
| D0A2 | LD (IX+$0A),$FF | Set the speed along y to FF. | ||||||
| D0A6 | RET | Return. | ||||||
| SteerTowardsTarget_UpY | D0A7 | LD (IX+$0A),$01 | Set the speed along y to 01. | |||||
| D0AB | RET | Return. | ||||||
| Prev: D07B | Up: Map | Next: D0AC |