Prev: B110 Up: Map Next: B185
B165: Point an object at the player
Used by the routines at SLOW_CHASER and SPARK_CHASER.
Sets the step in U and V to plus or minus the given speeds, each pointing from the object towards the robot's legs (PLAYER_U and the V after it) along its axis. The sign comes from the difference, so it is right while the two are less than 128 apart; level with him, the object steps the negative way. Knight Lore's move_towards_plyr, byte for byte in its logic.
Input
IX the object
C the speed in U
B the speed in V
MOVE_TOWARDS_PLAYER B165 LD HL,PLAYER_U own U less his U
B168 LD A,(IX+$01)
B16B SUB (HL)
B16C INC HL
B16D LD A,C +C if he is further along U, else -C
B16E JP M,MOVE_TOWARDS_PLAYER_0
B171 NEG
MOVE_TOWARDS_PLAYER_0 B173 LD (IX+$09),A
B176 LD A,(IX+$02) own V less his V
B179 SUB (HL)
B17A INC HL
B17B LD A,B +B if he is further along V, else -B
B17C JP M,MOVE_TOWARDS_PLAYER_1
B17F NEG
MOVE_TOWARDS_PLAYER_1 B181 LD (IX+$0A),A
B184 RET
Prev: B110 Up: Map Next: B185