Prev: 8A91 Up: Map Next: 8AFC
8AB6: Walk the rescued person after the player
Used by the routine at MOVE_RESCUEE.
Walks towards the player while two to five cells away, and stops beside them or more than five away. The facing is kept if one more step along it would still end beside the player; otherwise they turn towards the player.
FOLLOW_PLAYER 8AB6 LD A,(IX+$06) Not while stunned.
8AB9 AND A
8ABA RET NZ
8ABB LD E,(IY+$00)
8ABE LD D,(IY+$01)
8AC1 LD L,(IX+$00)
8AC4 LD H,(IX+$01)
8AC7 LD C,(IX+$04)
8ACA CALL DISTANCE
8ACD SET 2,(IX+$07) Walking, unless...
8AD1 CP $06 ...six or more away, or beside the player.
8AD3 JR NC,FOLLOW_PLAYER_2
8AD5 CP $01
8AD7 JR Z,FOLLOW_PLAYER_2
8AD9 AND A In the player's own cell.
8ADA JR NZ,FOLLOW_PLAYER_0
8ADC CALL ON_TOP
FOLLOW_PLAYER_0 8ADF LD A,C Would a step this way end beside the player?
8AE0 CALL STEP
8AE3 CALL DISTANCE
8AE6 DEC A
8AE7 JR Z,FOLLOW_PLAYER_1
8AE9 LD L,(IX+$00) No: face the player.
8AEC LD H,(IX+$01)
8AEF CALL DIRECTION_TO
8AF2 LD C,A
FOLLOW_PLAYER_1 8AF3 LD (IX+$04),C
8AF6 RET
FOLLOW_PLAYER_2 8AF7 RES 2,(IX+$07)
8AFB RET
Prev: 8A91 Up: Map Next: 8AFC