![]() |
Routines |
| Prev: B110 | Up: Map | Next: B185 |
|
Used by the routines at HandleChasingDome and HandleHomingSparkle.
Sets the speed of an object along the x and y axes so that it heads towards the player.
|
||||||||||||
|
Head towards the player along each axis.
|
||||||||||||
| SetSpeedTowardsPlayer | B165 | LD HL,$5B89 | Point HL at 5B89. | |||||||||
| B168 | LD A,(IX+$01) | Fetch the x position of the object. | ||||||||||
| B16B | SUB (HL) | Subtract the player's x position. | ||||||||||
| B16C | INC HL | Move on to the y position. | ||||||||||
| B16D | LD A,C | Fetch the speed along the x axis. | ||||||||||
| B16E | JP M,SetSpeedTowardsPlayer_SetX | Jump to SetSpeedTowardsPlayer_SetX if the object is west of the player. | ||||||||||
| B171 | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetX | B173 | LD (IX+$09),A | Set the speed along the x axis. | |||||||||
| B176 | LD A,(IX+$02) | Fetch the y position of the object. | ||||||||||
| B179 | SUB (HL) | Subtract the player's y position. | ||||||||||
| B17A | INC HL | Move on. | ||||||||||
| B17B | LD A,B | Fetch the speed along the y axis. | ||||||||||
| B17C | JP M,SetSpeedTowardsPlayer_SetY | Jump to SetSpeedTowardsPlayer_SetY if the object is south of the player. | ||||||||||
| B17F | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetY | B181 | LD (IX+$0A),A | Set the speed along the y axis. | |||||||||
| B184 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: B110 | Up: Map | Next: B185 |