| ← D1B9 | Map | D27E → |
D20F: Visor behavior handler
|
Runs the visor each frame. It has a two-phase life. While dormant it animates an 8-frame loop in place – no movement call – for 64 frames, then wakes. Once awake it homes on ball A, advances and animates the same loop. In either phase it dies to a ball kill and to the sweep. The far edge takes it.
|
|||
| update_visor | D20F | CALL inhabitant_react_state | Run the shared reaction machine; skip the update while a spawn or death animation plays. |
| D212 | RET C | ||
| D213 | LD A,(IY+$0C) | Branch on the state: the awake hunt runs here, the dormant warm-up below. | |
| D216 | CP $03 | ||
| D218 | JR NZ,update_visor_1 | ||
| D21A | LD HL,anim_visor | Awake: advance its 8-frame animation. | |
| D21D | CALL advance_anim | ||
| D220 | LD A,(IY+$0B) | Cycle the animation, and wrap the frame at the end of its table. | |
| D223 | CP $08 | ||
| D225 | JR C,update_visor_0 | ||
| D227 | LD (IY+$0B),$00 | ||
| update_visor_0 | D22B | LD B,$01 | Home on the ball and advance. |
| D22D | CALL head_toward_target | ||
| D230 | CALL move_object | ||
| D233 | CALL inhabitant_offscreen | Despawn off the far edge. | |
| D236 | RET C | ||
| D237 | LD B,$05 | A ball kill destroys it for 50 points. | |
| D239 | CALL ball_kill | ||
| D23C | RET C | ||
| D23D | CALL overlap_sweep | The sweep kills it, and the death animation runs. | |
| D240 | OR A | ||
| D241 | RET Z | ||
| D242 | LD (IY+$0B),$00 | ||
| D246 | LD (IY+$0C),$02 | ||
| D24A | RET | ||
| update_visor_1 | D24B | LD HL,anim_visor | Dormant: animate the same 8-frame loop, but in place (no movement). |
| D24E | CALL advance_anim | ||
| D251 | LD A,(IY+$0B) | Run the animation on a loop, and wrap at the end of its table. | |
| D254 | CP $08 | ||
| D256 | JR C,update_visor_2 | ||
| D258 | LD (IY+$0B),$00 | ||
| update_visor_2 | D25C | INC (IY+$09) | Warm-up timer: once it runs out, start the hunt. |
| D25F | LD A,(IY+$09) | ||
| D262 | CP $40 | ||
| D264 | JR NZ,update_visor_3 | ||
| D266 | LD (IY+$0C),$03 | ||
| update_visor_3 | D26A | LD B,$05 | Even while dormant, a ball kill destroys it for 50 points. |
| D26C | CALL ball_kill | ||
| D26F | RET C | ||
| D270 | CALL overlap_sweep | The sweep kills a dormant visor too. | |
| D273 | OR A | ||
| D274 | RET Z | ||
| D275 | LD (IY+$0B),$00 | ||
| D279 | LD (IY+$0C),$02 | ||
| D27D | RET | ||
| ← D1B9 | Map | D27E → |
