Prev: BFF1 Up: Map Next: C057
C02C: Step the thing at IX two units towards the knight along each axis
Used by the routine at CREATURE_UPDATE.
The creature's homing (CREATURE_UPDATE): its steps, +A and +B, become 2 or -2 by the side of the knight it is on, comparing the whole 16-bit positions; level with him on an axis it still steps forward along it.
Input
IX the record
STEER_AT_KNIGHT C02C LD E,(IX+$01) +A: 2 if he is further along U, or level; otherwise -2
C02F LD D,(IX+$02)
C032 LD HL,(KNIGHT_U)
C035 AND A
C036 SBC HL,DE
C038 LD A,$02
C03A JR NC,STEER_AT_KNIGHT_0
C03C NEG
STEER_AT_KNIGHT_0 C03E LD (IX+$0A),A
C041 LD E,(IX+$03) +B the same along V
C044 LD D,(IX+$04)
C047 LD HL,(KNIGHT_V)
C04A AND A
C04B SBC HL,DE
C04D LD A,$02
C04F JR NC,STEER_AT_KNIGHT_1
C051 NEG
STEER_AT_KNIGHT_1 C053 LD (IX+$0B),A
C056 RET
Prev: BFF1 Up: Map Next: C057