← CD6B Wide overlap test between two named objects Map CDE8 → UFO behavior handler
CDB1: Face-monster behavior handler
Runs the face monster each frame. It wanders on a random heading.
Input
IX the inhabitant's object_table sprite record
IY the inhabitant's obj2_record logic record
C the inhabitant's pool-slot index
Animation: the three face sprites ping-pong, each held 6 game frames. Movement: the wander step re-randomizes the heading, unconstrained, when the slot's wander timer expires. The wall-avoid probe then steers it clear, and the move routine advances it one step and publishes the heading code.
update_face_monster CDB1 CALL inhabitant_react_state Run the reaction-state step first; while a spawn or death animation plays, it returns carry and the rest of the handler is skipped.
CDB4 RET C
CDB5 LD HL,anim_face_monster Animate from the face frame table, one step every other frame. Wrap the animation frame at the table's end.
CDB8 CALL advance_anim
CDBB LD A,(IY+$0B)
CDBE CP $0C
CDC0 JR C,face_steer
CDC2 LD (IY+$0B),$00
face_steer CDC6 XOR A Leave the wander unconstrained: every heading is allowed.
CDC7 CALL pick_wander_heading Wander: re-randomize the heading when the slot's wander timer runs out.
CDCA CALL object_avoid_walls Steer clear of the playfield walls.
CDCD CALL move_object Advance one step along the heading and publish the heading code.
CDD0 CALL inhabitant_offscreen Despawn once it has crossed off the far edge; carry returns and the handler stops.
CDD3 RET C
CDD4 LD B,$05 Ball kill: a ball overlap kills the monster for 50 points, banked into the pending score. The handler then stops.
CDD6 CALL ball_kill
CDD9 RET C
CDDA CALL overlap_sweep The sweep hits: restart the animation and start the death sequence (no score).
CDDD OR A
CDDE RET Z
CDDF LD (IY+$0B),$00
CDE3 LD (IY+$0C),$02
CDE7 RET
← CD6B Wide overlap test between two named objects Map CDE8 → UFO behavior handler
Fork me on GitHub