![]() |
Routines |
| Prev: B92C | Up: Map | Next: B985 |
|
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 | B965 | LD HL,$5C09 | Point HL at the X coordinate of the player. | |||||||||
| B968 | LD A,(IX+$01) | Fetch the X coordinate of the object. | ||||||||||
| B96B | SUB (HL) | Subtract the X coordinate of the player. | ||||||||||
| B96C | INC HL | Point HL at the Y coordinate of the player. | ||||||||||
| B96D | LD A,C | Fetch the speed in X. | ||||||||||
| B96E | JP M,SetSpeedTowardsPlayer_SetX | Jump to SetSpeedTowardsPlayer_SetX if the object is on the west side of the player. | ||||||||||
| B971 | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetX | B973 | LD (IX+$09),A | Set the speed in X of the object. | |||||||||
| B976 | LD A,(IX+$02) | Fetch the Y coordinate of the object. | ||||||||||
| B979 | SUB (HL) | Subtract the Y coordinate of the player. | ||||||||||
| B97A | INC HL | Point HL at the Z coordinate of the player. | ||||||||||
| B97B | LD A,B | Fetch the speed in Y. | ||||||||||
| B97C | JP M,SetSpeedTowardsPlayer_SetY | Jump to SetSpeedTowardsPlayer_SetY if the object is on the south side of the player. | ||||||||||
| B97F | NEG | Make the speed negative. | ||||||||||
| SetSpeedTowardsPlayer_SetY | B981 | LD (IX+$0A),A | Set the speed in Y of the object. | |||||||||
| B984 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: B92C | Up: Map | Next: B985 |