← D44B Comet behavior handler Map D4E8 → Dart behavior handler
D47C: Warp-gate behavior handler
Runs the warp gate, which sits static. Each frame its X is re-pinned to the bat's fixed edge column, read from the bat's sprite record, and its Y is held at 40. Its speed is 0, so it does not move. Animation is the 4-frame table, wrapped at frame 4.
A ball kill destroys it for 1000 points. An overlap with the bat raises the warp flag and loads a random 2-to-5 warp countdown. The main loop then advances the level once per frame until the countdown clears. That carries the player forward 1 to 4 levels.
update_warp_gate D47C PUSH IY Pin the X position to the bat's column; fix Y at a constant row.
D47E LD IY,object_table
D482 LD A,(IY+$00)
D485 LD (IX+$00),A
D488 POP IY
D48A LD A,$28
D48C LD (IX+$01),A
D48F CALL inhabitant_react_state Reaction-state machine; while a spawn or death animation plays it returns carry and skips the rest.
D492 RET C
D493 LD A,(bat_side) Head away from the bat's side: leftward when the bat is on the right.
D496 OR A
D497 JR NZ,warp_gate_bat_left
D499 LD A,$06
D49B JR warp_gate_animate
warp_gate_bat_left D49D LD A,$02 Bat on the left: take the rightward heading.
warp_gate_animate D49F LD (IY+$00),A Store the heading, then advance and wrap the 4-frame animation.
D4A2 LD HL,anim_warp_gate
D4A5 CALL advance_anim
D4A8 LD A,(IY+$0B)
D4AB CP $04
D4AD JR C,warp_gate_move
D4AF LD (IY+$0B),$00
warp_gate_move D4B3 CALL move_object Run the step, which leaves it in place at speed 0. A ball kill removes it for 1000 points, banked into the pending score.
D4B6 LD B,$64
D4B8 CALL ball_kill
D4BB RET C
warp_gate_bat_test D4BC LD A,C Test overlap with the bat itself through the first and second overlap operands.
D4BD LD (overlap_slot_1),A
D4C0 XOR A
D4C1 LD (overlap_slot_2),A
D4C4 CALL overlap_pair
D4C7 OR A
D4C8 JR Z,warp_gate_sweep
warp_gate_advance D4CA LD A,$01 On the bat overlap, raise the warp flag and load a random 2-to-5 countdown. The main loop advances the level while it counts down.
D4CC LD (warp_active_flag),A
D4CF CALL next_random
D4D2 AND $03
D4D4 INC A
D4D5 INC A
D4D6 LD (warp_countdown),A
D4D9 RET
warp_gate_sweep D4DA CALL overlap_sweep No bat overlap: the sweep kills it.
D4DD OR A
D4DE RET Z
D4DF LD (IY+$0B),$00
D4E3 LD (IY+$0C),$02
D4E7 RET
← D44B Comet behavior handler Map D4E8 → Dart behavior handler
Fork me on GitHub