Prev: DD6A Up: Map Next: DD99
DD72: Turn Towards Player
Turns an object towards the player, by a quarter back (from TurnTowardsPlayer_Back), by a quarter on (from TurnTowardsPlayer_On) or, from TurnTowardsPlayer, right round by turning a quarter in a direction chosen from the random seed. The direction gets a timer of one to sixteen.
Input
IX Object
TurnTowardsPlayer DD72 LD A,($BBAB) Fetch the random seed, and jump to TurnTowardsPlayer_On if it is less than 80.
DD75 CP $80
DD77 JR C,TurnTowardsPlayer_On
TurnTowardsPlayer_Back DD79 LD A,(IX+$06) Turn back a quarter.
DD7C SUB $40
TurnTowardsPlayer_Set DD7E LD (IX+$06),A Set the direction.
TurnTowardsPlayer_Timer DD81 LD A,(IX+$06) Fetch the direction, and keep only the direction.
DD84 AND $C0
DD86 LD C,A
DD87 LD A,($BBAA) Set a timer of one to sixteen from the random seed.
DD8A AND $0F
DD8C INC A
DD8D OR C
DD8E LD (IX+$06),A
DD91 RET Return.
TurnTowardsPlayer_On DD92 LD A,(IX+$06) Turn on a quarter, and jump to TurnTowardsPlayer_Set.
DD95 ADD A,$40
DD97 JR TurnTowardsPlayer_Set
Prev: DD6A Up: Map Next: DD99