![]() |
Routines |
| Prev: 45328 | Up: Map | Next: 45445 |
|
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 | 45413 | LD HL,23433 | Point HL at 23433. | |||||||||
| 45416 | LD A,(IX+1) | Fetch the x position of the object. | ||||||||||
| 45419 | SUB (HL) | Subtract the player's x position. | ||||||||||
| 45420 | INC HL | Move on to the y position. | ||||||||||
| 45421 | LD A,C | Fetch the speed along the x axis. | ||||||||||
| 45422 | JP M,SetSpeedTowardsPlayer_SetX | Jump to SetSpeedTowardsPlayer_SetX if the object is west of the player. | ||||||||||
| 45425 | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetX | 45427 | LD (IX+9),A | Set the speed along the x axis. | |||||||||
| 45430 | LD A,(IX+2) | Fetch the y position of the object. | ||||||||||
| 45433 | SUB (HL) | Subtract the player's y position. | ||||||||||
| 45434 | INC HL | Move on. | ||||||||||
| 45435 | LD A,B | Fetch the speed along the y axis. | ||||||||||
| 45436 | JP M,SetSpeedTowardsPlayer_SetY | Jump to SetSpeedTowardsPlayer_SetY if the object is south of the player. | ||||||||||
| 45439 | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetY | 45441 | LD (IX+10),A | Set the speed along the y axis. | |||||||||
| 45444 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 45328 | Up: Map | Next: 45445 |