← CDE8 UFO behavior handler Map CE5F → Bowling-ball behavior handler
CE27: Diamond behavior handler
Per-frame behavior handler for the diamond. It homes toward ball A, so it chases the ball around the playfield. Its death payload is the face monster's (update_face_monster).
Input
IX the inhabitant's sprite record
IY the inhabitant's logic record
C the inhabitant's pool-slot index
Animation: the four diamond sprites ping-pong, each shown 4 game frames. Movement: each frame it points its heading at ball A. Then it avoids walls and advances one step.
update_diamond CE27 CALL inhabitant_react_state Run the reaction-state step; carry skips the rest during a spawn or death animation.
CE2A RET C
CE2B LD HL,anim_diamond Animate from the diamond frame table (4 sprites, played forward and back). Wrap the animation frame at the table's end.
CE2E CALL advance_anim
CE31 LD A,(IY+$0B)
CE34 CP $0C
CE36 JR C,diamond_steer
CE38 LD (IY+$0B),$00
diamond_steer CE3C LD B,$01 Home: turn the heading toward ball A, so the diamond tracks the ball.
CE3E CALL head_toward_target
CE41 CALL object_avoid_walls Steer clear of the walls.
CE44 CALL move_object Advance one step and publish the heading code.
CE47 CALL inhabitant_offscreen Despawn at the far edge.
CE4A RET C
CE4B LD B,$05 Ball kill: it dies for 50 points, banked into the pending score.
CE4D CALL ball_kill
CE50 RET C
CE51 CALL overlap_sweep The sweep hits: restart the animation and start the death sequence (no score).
CE54 OR A
CE55 RET Z
CE56 LD (IY+$0B),$00
CE5A LD (IY+$0C),$02
CE5E RET
← CDE8 UFO behavior handler Map CE5F → Bowling-ball behavior handler
Fork me on GitHub