![]() |
Routines |
| Prev: 8813 | Up: Map | Next: 882B |
|
Used by the routine at update_ground_objects.
Called by update_ground_objects for each ground object whose +$18 bits 1-3 give a kind of shot (1-7, in scratch_count). One pass in 16 at random (random_a AND $5A zero), and only when the object is on the screen (+$10 bit 7).
fire_from, also used by attackers (attacker_fires), fires the shot. It needs a free record among the three for shots, 4-6 of object_records, and the shooter between x $18 and $BF on the screen; the kind's flags (shot_kind_flags) may also want it in the top or bottom part of the screen. The new record is a type $1C object at the shooter's place, given the kind's template (shot_kind_templates), its colour, and then moved once by the template's numbers (move_object), which puts the shot at the gun's mouth. Then its real velocity is set by the frame it has:
Frame 0 (kind 1, a bullet thrown up): a random spray upwards (the spray code in fire_from) that gravity brings down (Y acceleration $0020); one throw in eight is the shield ball (frame 9) instead, and every (lives x 4)th throw is the extra-life ship icon (frame 8, counted by extra_life_countdown) -- so the fewer lives the player has, the more often extra lives come up. Frames 5 and 6 (kinds 4 and 5): a random spray upwards. Frame 7 (kind 6): the same, downwards when the shooter is in the upper part of the screen (fire_spray_down). Frame 10 (kinds 7 and 8, the attackers' shots): straight across at 6 pixels a pass, right for kind 7 and left for 8. Any other frame (kinds 2 and 3, the refuel pick-up thrown up and a pellet dropped): half the shooter's X velocity and 5 pixels a pass up, or down when the kind's flags have bit 7. A shot is sounded (sound_fire) unless the spray came to nothing.
|
||||||||
| ground_object_fires | 8820 | LD A,(random_a) | One pass in 16 | |||||
| 8823 | AND $5A | |||||||
| 8825 | RET NZ | |||||||
| 8826 | BIT 7,(IX+$10) | Only while on the screen | ||||||
| 882A | RET Z | |||||||
| Prev: 8813 | Up: Map | Next: 882B |