Prev: 87A6 Up: Map Next: 8862
882D: Set a heading towards the player
Compares the target's position with its own on each axis and sets the velocity fields to $FF or $01 accordingly -- the crudest possible pursuit, one pixel a frame towards wherever the player is, with no smoothing and no memory. It is what makes some creatures follow you rather than drift.
HOME_IN 882D LD C,$00
882F LD A,D
8830 CP (IX+$04)
8833 JR Z,HOME_IN_1
8835 JR NC,HOME_IN_2
8837 LD (IX+$09),$FF
HOME_IN_0 883B LD A,E
883C CP (IX+$03)
883F JR Z,HOME_IN_3
8841 JR NC,HOME_IN_4
8843 LD (IX+$08),$FF
8847 RET
HOME_IN_1 8848 LD (IX+$09),$00
884C SET 0,C
884E JR HOME_IN_0
HOME_IN_2 8850 LD (IX+$09),$01
8854 JR HOME_IN_0
HOME_IN_3 8856 LD (IX+$08),$00
885A SET 1,C
885C RET
HOME_IN_4 885D LD (IX+$08),$01
8861 RET
Prev: 87A6 Up: Map Next: 8862