← CDB1 Face-monster behavior handler Map CE27 → Diamond behavior handler
CDE8: UFO behavior handler
Runs the UFO each frame. Nothing reaches it in the shipped game. No wave script and no handler spawns the UFO. This handler therefore never runs. What follows is what it would do.
Unlike the face monster, it neither wanders nor avoids walls. Each frame it forces a fixed horizontal heading straight toward the bat's losing edge, and glides across. It dies on a ball kill (50 points). It despawns at the far edge. A sweep hit restarts its animation and starts the death sequence.
Heading select: leftward when the bat plays on the left, rightward when it plays on the right. Those headings therefore always point across the field toward the bat.
Animation: two wing sprites alternate, each shown for 4 frames.
update_ufo CDE8 CALL inhabitant_react_state Run the reaction-state step; carry skips the rest while a spawn or death animation plays.
CDEB RET C
CDEC LD A,(bat_side) Pick the heading from the bat side. The bat on the right takes the next case, and the bat on the left jumps to the leftward case.
CDEF OR A
CDF0 JR NZ,ufo_head_left
CDF2 LD A,$02 Bat on the right: head rightward, toward it.
CDF4 JR ufo_set_heading
ufo_head_left CDF6 LD A,$06 Bat on the left: head leftward, toward it.
ufo_set_heading CDF8 LD (IY+$00),A Store the chosen heading in the UFO's logic record.
CDFB LD HL,anim_ufo Animate from the UFO's frame table. Each of the two sprites holds two table entries, so each stays up for two animation steps. Wrap the animation frame at the table's end.
CDFE CALL advance_anim
CE01 LD A,(IY+$0B)
CE04 CP $04
CE06 JR C,ufo_move
CE08 LD (IY+$0B),$00
ufo_move CE0C CALL move_object Advance one step along the fixed heading and publish the heading code. There is no wander or wall-avoidance.
CE0F CALL inhabitant_offscreen Despawn at the far edge.
CE12 RET C
CE13 LD B,$05 Ball kill: a ball overlap kills it for 50 points, banked into the pending score.
CE15 CALL ball_kill
CE18 RET C
CE19 CALL overlap_sweep The sweep hits: restart the animation and start the death sequence (no score).
CE1C OR A
CE1D RET Z
CE1E LD (IY+$0B),$00
CE22 LD (IY+$0C),$02
CE26 RET
← CDB1 Face-monster behavior handler Map CE27 → Diamond behavior handler
Fork me on GitHub