![]() |
Routines |
| Prev: 47404 | Up: Map | Next: 47493 |
|
Used by the routines at SendSparkleAtPlayer and HandleRepelSpell.
Sets the speeds of an object so that it moves towards the player.
|
||||||||||||
|
Set the X speed towards the player, then the Y speed.
|
||||||||||||
| SetSpeedTowardsPlayer | 47461 | LD HL,23561 | Point HL at the X coordinate of the player. | |||||||||
| 47464 | LD A,(IX+1) | Fetch the X coordinate of the object. | ||||||||||
| 47467 | SUB (HL) | Subtract the X coordinate of the player. | ||||||||||
| 47468 | INC HL | Point HL at the Y coordinate of the player. | ||||||||||
| 47469 | LD A,C | Fetch the speed in X. | ||||||||||
| 47470 | JP M,SetSpeedTowardsPlayer_SetX | Jump to SetSpeedTowardsPlayer_SetX if the object is on the west side of the player. | ||||||||||
| 47473 | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetX | 47475 | LD (IX+9),A | Set the speed in X of the object. | |||||||||
| 47478 | LD A,(IX+2) | Fetch the Y coordinate of the object. | ||||||||||
| 47481 | SUB (HL) | Subtract the Y coordinate of the player. | ||||||||||
| 47482 | INC HL | Point HL at the Z coordinate of the player. | ||||||||||
| 47483 | LD A,B | Fetch the speed in Y. | ||||||||||
| 47484 | JP M,SetSpeedTowardsPlayer_SetY | Jump to SetSpeedTowardsPlayer_SetY if the object is on the south side of the player. | ||||||||||
| 47487 | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetY | 47489 | LD (IX+10),A | Set the speed in Y of the object. | |||||||||
| 47492 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: 47404 | Up: Map | Next: 47493 |