Prev: 8792 Up: Map Next: 87E7
87AF: Count towards the next attacker, and run the meteor-shower timer
Used by the routine at play.
Called by the play loop (play) once a pass. Nothing while the load (object_load) is 8 or more.
The meteor-shower timer (meteor_shower): when it is 0, a shower starts on the passes when the random byte random_a is $6A and the low two bits of its second byte are 0 -- one pass in 1024 -- and lasts 128 passes, during which start_attacker puts rocks and comets near the ship instead of attackers.
Every eighth pass (spawn_countdown at 7) a cloud may start (spawn_cloud); at 0 the count starts again from 8 and the entry at spawn_attacker looks for a free record among the attackers' four (attacker_records) and fills it (start_attacker). update_objects also jumps to spawn_attacker when the load is light.
spawn_tick 87AF LD A,(object_load) Not when the load is 8 or more
87B2 CP $08
87B4 RET NC
87B5 LD A,(meteor_shower) A shower running: count it down below
87B8 AND A
87B9 JR NZ,spawn_tick_0
87BB LD A,(random_a) Start one at random: 128 passes
87BE CP $6A
87C0 JR NZ,spawn_tick_1
87C2 LD A,(random_b)
87C5 AND $03
87C7 JR NZ,spawn_tick_1
87C9 OR $80
87CB LD (meteor_shower),A
87CE JR spawn_tick_1
spawn_tick_0 87D0 DEC A Count the shower down
87D1 LD (meteor_shower),A
spawn_tick_1 87D4 LD A,(spawn_countdown) Count the passes; at 7, a cloud
87D7 DEC A
87D8 LD (spawn_countdown),A
87DB CP $07
87DD JP Z,spawn_cloud
87E0 AND A At 0, from 8 again, and an attacker
87E1 RET NZ
87E2 LD A,$08
87E4 LD (spawn_countdown),A
Prev: 8792 Up: Map Next: 87E7