← D20F Visor behavior handler Map D398 → Hockey-mask behavior handler
D27E: Starburst behavior handler
Per-frame handler for the starburst. It wanders the playfield until a ball touches it. The touch scores 100, and knocks it into a slide along that ball's heading. The force-clear path empties every brick the slide crosses, the golden brick included.
Input
IX the starburst's sprite record
IY the starburst's logic record, read for its animation frame, its state and the knock-back immunity counter
C the starburst's pool-slot index
knockback_table D27E DEFB $02 Knock-back heading for each ball heading code, counted from the first code.
D27F DEFB $02
D280 DEFB $02
D281 DEFB $02
D282 DEFB $02
D283 DEFB $02
D284 DEFB $01
D285 DEFB $01
D286 DEFB $01
D287 DEFB $01
D288 DEFB $01
D289 DEFB $01
D28A DEFB $01
D28B DEFB $00
D28C DEFB $00
D28D DEFB $00
D28E DEFB $00
D28F DEFB $00
D290 DEFB $00
D291 DEFB $00
D292 DEFB $00
D293 DEFB $00
D294 DEFB $00
D295 DEFB $00
D296 DEFB $07
D297 DEFB $07
D298 DEFB $07
D299 DEFB $07
D29A DEFB $07
D29B DEFB $07
D29C DEFB $07
D29D DEFB $06
D29E DEFB $06
D29F DEFB $06
D2A0 DEFB $06
D2A1 DEFB $06
D2A2 DEFB $06
D2A3 DEFB $06
D2A4 DEFB $06
D2A5 DEFB $06
D2A6 DEFB $06
D2A7 DEFB $06
D2A8 DEFB $05
D2A9 DEFB $05
D2AA DEFB $05
D2AB DEFB $05
D2AC DEFB $05
D2AD DEFB $05
D2AE DEFB $05
D2AF DEFB $04
D2B0 DEFB $04
D2B1 DEFB $04
D2B2 DEFB $04
D2B3 DEFB $04
D2B4 DEFB $04
D2B5 DEFB $04
D2B6 DEFB $04
D2B7 DEFB $04
D2B8 DEFB $04
D2B9 DEFB $04
D2BA DEFB $03
D2BB DEFB $03
D2BC DEFB $03
D2BD DEFB $03
D2BE DEFB $03
D2BF DEFB $03
D2C0 DEFB $03
D2C1 DEFB $02
D2C2 DEFB $02
D2C3 DEFB $02
D2C4 DEFB $02
D2C5 DEFB $02
update_starburst D2C6 CALL inhabitant_react_state Reaction-state machine first; while a spawn or death animation plays it returns carry and the rest is skipped.
D2C9 RET C
D2CA LD A,(IY+$0C) Split on state: the knock-back arm runs here, and any other state takes the normal wander. Only the wander arm reaches the sweep.
D2CD CP $03
D2CF JR NZ,starburst_wander
D2D1 LD HL,anim_starburst Knock-back: advance and wrap the 3-frame animation.
D2D4 CALL advance_anim
D2D7 LD A,(IY+$0B)
D2DA CP $03
D2DC JR C,starburst_knock_edge
D2DE LD (IY+$0B),$00
starburst_knock_edge D2E2 CALL test_step_collision In the slide along the ball's heading, a step onto a wall raises the wall qualifier. It then resets the animation and dies, and scores nothing.
D2E5 LD A,(step_hit_wall)
D2E8 OR A
D2E9 JR Z,starburst_knock_step
D2EB LD (IY+$0B),$00
D2EF LD (IY+$0C),$02
D2F3 RET
starburst_knock_step D2F4 CALL move_object Slide one step along the heading; despawn if it has left the field.
D2F7 CALL inhabitant_offscreen
D2FA RET C
D2FB LD A,(IY+$09) Immune for the first four slide frames. The kill below runs from the fifth.
D2FE CP $04
D300 JR Z,starburst_knock_kill
D302 INC (IY+$09)
D305 RET
starburst_knock_kill D306 LD B,$0A Past the immunity window a ball kill takes it for another 100 points on top of the catch, so one starburst can pay 200.
D308 CALL ball_kill
D30B RET
starburst_wander D30C LD HL,anim_starburst Normal path: advance and wrap the 3-frame animation.
D30F CALL advance_anim
D312 LD A,(IY+$0B)
D315 CP $03
D317 JR C,starburst_wander_move
D319 LD (IY+$0B),$00
starburst_wander_move D31D XOR A Wander: re-pick the heading when the move timer expires, avoid walls, step, then despawn off the far edge.
D31E CALL pick_wander_heading
D321 CALL object_avoid_walls
D324 CALL move_object
D327 CALL inhabitant_offscreen
D32A RET C
While it wanders the starburst uses the 12-px overlap, narrower than the ball kill that most handlers use. A ball has to come closer to catch it.
D32B LD A,C Test ball A against the starburst through the first and second overlap operands. An overlap takes the catch.
D32C LD (overlap_slot_1),A
D32F LD A,$01
D331 LD (overlap_slot_2),A
D334 CALL overlap_pair
D337 OR A
D338 JR NZ,starburst_catch_ball1
starburst_test_ball2 D33A PUSH IX No overlap with ball A: test ball B too, but only while the secondary object shows the ball sprite. An overlap takes the catch.
D33C LD IX,obj2_object
D340 LD L,(IX+$06)
D343 LD H,(IX+$07)
D346 POP IX
D348 LD DE,slot_ball
D34B XOR A
D34C SBC HL,DE
D34E JR NZ,starburst_sweep
D350 LD A,C
D351 LD (overlap_slot_1),A
D354 LD A,$02
D356 LD (overlap_slot_2),A
D359 CALL overlap_pair
D35C OR A
D35D JR NZ,starburst_catch_ball2
starburst_sweep D35F CALL overlap_sweep No overlap with a ball: the sweep kills it; otherwise it survives the frame.
D362 OR A
D363 RET Z
D364 LD (IY+$0B),$00
D368 LD (IY+$0C),$02
D36C RET
starburst_catch_ball1 D36D LD A,(ball_a_heading) Ball A catch: read ball A's heading code.
D370 JR starburst_catch_apply
starburst_catch_ball2 D372 LD A,(ball_b_heading) Ball B catch: read ball B's heading code.
starburst_catch_apply D375 LD (IY+$0B),$00 Enter the knock-back. Reset the animation, set the slide speed so each step moves it 4 px, and clear the immunity counter. Map the ball's heading code through the knock-back table, offset from the base of the heading range, to orient the heading. Stage the 100-point reward as this frame's pending points.
D379 LD (IY+$0C),$03
D37D LD (IY+$01),$05
D381 LD (IY+$09),$00
D385 SUB $48
D387 LD E,A
D388 LD D,$00
D38A LD HL,knockback_table
D38D ADD HL,DE
D38E LD A,(HL)
D38F LD (IY+$00),A
D392 LD A,$0A
D394 LD (pending_score),A
D397 RET
← D20F Visor behavior handler Map D398 → Hockey-mask behavior handler
Fork me on GitHub