| ← CE27 | Map | CEB3 → |
CE5F: Bowling-ball behavior handler
|
Per-frame behavior handler for the bowling ball. It charges the bat. When it reaches the bat, it freezes the bat and self-destructs. It dies on a ball kill, worth 200 points.
|
|||||||||||
|
|||||||||||
|
Animation: the three ball sprites roll forward, each shown 4 game frames. Movement: it steers toward the bat, avoids walls and advances. Test order: the ball kill comes first. Then the overlap test checks the bat alone. On a hit the bowling ball dies and raises the bat freeze, which locks the bat for 15 frames until the bat mover releases it. Otherwise the sweep takes it in a plain kill.
|
|||||||||||
| update_bowling_ball | CE5F | CALL inhabitant_react_state | Run the reaction-state step; carry skips the rest during a spawn or death animation. | ||||||||
| CE62 | RET C | ||||||||||
| CE63 | LD HL,anim_bowling_ball | Animate from the bowling-ball frame table (3 sprites, forward roll). Wrap the animation frame at the table's end. | |||||||||
| CE66 | CALL advance_anim | ||||||||||
| CE69 | LD A,(IY+$0B) | ||||||||||
| CE6C | CP $06 | ||||||||||
| CE6E | JR C,bowling_steer | ||||||||||
| CE70 | LD (IY+$0B),$00 | ||||||||||
| bowling_steer | CE74 | LD B,$00 | Home: turn the heading toward the bat, so the ball charges it. | ||||||||
| CE76 | CALL head_toward_target | ||||||||||
| CE79 | CALL object_avoid_walls | Steer clear of the walls. | |||||||||
| CE7C | CALL move_object | Advance one step and publish the heading code. | |||||||||
| CE7F | LD B,$14 | Ball kill: it dies for 200 points, banked into the pending score. | |||||||||
| CE81 | CALL ball_kill | ||||||||||
| CE84 | RET C | ||||||||||
| bowling_freeze_test | CE85 | LD A,C | Stage the inhabitant (C) and the bat as the operand pair, then test the overlap with the bat alone. | ||||||||
| CE86 | LD (overlap_slot_1),A | ||||||||||
| CE89 | XOR A | ||||||||||
| CE8A | LD (overlap_slot_2),A | ||||||||||
| CE8D | CALL overlap_pair | ||||||||||
| CE90 | OR A | No bat overlap: fall through to the sweep. | |||||||||
| CE91 | JR Z,bowling_sweep | ||||||||||
| bowling_bat_freeze | CE93 | LD (IY+$0B),$00 | Reached the bat: restart the animation and start the death sequence. Raise the bat freeze and zero the freeze timer, so the bat is locked out for 15 frames. | ||||||||
| CE97 | LD (IY+$0C),$02 | ||||||||||
| CE9B | LD A,$01 | ||||||||||
| CE9D | LD (bat_freeze),A | ||||||||||
| CEA0 | XOR A | ||||||||||
| CEA1 | LD (bat_freeze_timer),A | ||||||||||
| CEA4 | RET | ||||||||||
| bowling_sweep | CEA5 | CALL overlap_sweep | Otherwise the sweep hits: restart the animation and start the death sequence (no score). | ||||||||
| CEA8 | OR A | ||||||||||
| CEA9 | RET Z | ||||||||||
| CEAA | LD (IY+$0B),$00 | ||||||||||
| CEAE | LD (IY+$0C),$02 | ||||||||||
| CEB2 | RET | ||||||||||
| ← CE27 | Map | CEB3 → |
