| 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 finalize_collision to finalize collision. Clears CONTROLS_BIT_FIRE_SOUND 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) | Backup coords to state_saved_object_coords; if first pass, adjust for scroll. | ||
| 6747 | LD ($5F8D),BC | |||
| 674B | LD A,($673C) | |||
| 674E | CP $01 | |||
| 6750 | CALL Z,advance_object | |||
| 6753 | LD ($8B0A),BC | Store previous position to previous_object_coordinates. | ||
| 6757 | LD BC,($5EF3) | Calculate new position: X = plane_X + 4, Y = missile_Y - 6. | ||
| 675B | LD A,($5F72) | |||
| 675E | ADD A,$04 | |||
| 6760 | LD C,A | |||
| 6761 | LD A,B | |||
| 6762 | SUB $06 | |||
| 6764 | LD B,A | If Y reached top of screen, jump to finalize_collision. | ||
| 6765 | AND $F8 | |||
| 6767 | CP $00 | |||
| 6769 | JP Z,finalize_collision | (continued) Store new coordinates to state_plane_missile_y. | ||
| 676C | LD ($5EF3),BC | |||
| 6770 | LD A,$70 | If missile in lower area, call clear_fire_bit to clear fire bit. | ||
| 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 and call render_sprite to render missile. | ||
| 6782 | LD HL,$8431 | |||
| 6785 | LD BC,$0008 | |||
| 6788 | LD A,$01 | |||
| 678A | CALL render_sprite | |||
| 678D | RET | |||
| Prev: 673C | Up: Map | Next: 678E |