Fork me on GitHub
Prev: 673C Up: Map Next: 678E
673D: Animate and render player missile
Missile speed: 6 pixels upward per frame. Called twice per frame for two-pass rendering (erase then draw).
On the first pass (missile_pass_selector = $01), adjusts missile position for screen scrolling. On both passes, moves missile up by 6 pixels.
If missile reaches top of screen (Y AND $F8 == 0), jumps to deactivate_missile to deactivate missile. Clears SOUND_BIT_FIRE when missile is in lower screen area ($70 - Y >= 0).
Sets COLLISION_MODE_MISSILE so the rendering system checks for object collisions.
animate_plane_missile 673D LD A,($5EF3) Return if no missile active (Y == 0).
6740 CP $00
6742 RET Z
6743 LD BC,($5EF3) Save current position to state_saved_object_coords.
6747 LD ($5F8D),BC
674B LD A,($673C) If first pass, adjust position for scroll.
674E CP $01
6750 CALL Z,advance_object
6753 LD ($8B0A),BC Store current position as previous for sprite erasure.
6757 LD BC,($5EF3) X = plane_X + 4.
675B LD A,($5F72)
675E ADD A,$04
6760 LD C,A
6761 LD A,B Y = missile_Y - 6.
6762 SUB $06
6764 LD B,A
6765 AND $F8 If missile reached top of screen, jump to deactivate_missile.
6767 CP $00
6769 JP Z,deactivate_missile
676C LD ($5EF3),BC Store new missile position.
6770 LD A,$70 If missile has risen to Y ≤ $70, stop fire sound.
6772 SUB B
6773 CALL P,clear_fire_bit
6776 LD ($8B0C),BC Store position to object_coordinates.
677A LD A,$02 Set COLLISION_MODE_MISSILE in state_collision_mode.
677C LD ($5EF5),A
677F LD DE,$080C Set up sprite params.
6782 LD HL,$8431
6785 LD BC,$0008
6788 LD A,$01
678A CALL render_sprite
678D RET
Prev: 673C Up: Map Next: 678E