Prev: B962 Up: Map Next: B973
B965: Point an object at the player
Used by the routines at spark_home_in and chaser_chase.
Sets dX and dY to plus or minus the given speeds, each pointing from the object towards the player along its axis. The sign is taken from the difference, so it is right as long as the two are less than 128 apart. When they are level the object steps back the negative way, so a chaser jitters about the player rather than stopping on him.
Input
IX the object
C the speed along X
B the speed along Y
move_towards_plyr B965 LD HL,$5C09 own X minus the player's X
B968 LD A,(IX+$01)
B96B SUB (HL)
B96C INC HL C if the player is further along X, else -C
B96D LD A,C
B96E JP M,towards_plyr_y
B971 NEG
Prev: B962 Up: Map Next: B973