Prev: 35085 Up: Map Next: 35184
35124: Set Falling Speed
Used by the routine at FireShot.
Gives an object a random speed and then sets its vertical acceleration.
Input
IY Address of the object
SetFallingSpeed 35124 CALL SetRandomSpeed Give the object a random speed.
35127 LD A,(IY+9) Fetch the vertical speed.
35130 AND A Test it.
35131 JR Z,SetRandomSpeed_Remove Remove the object if it is zero.
35133 LD A,R Fetch a random number...
35135 AND %00000111 ...and keep three bits.
35137 JR NZ,SetFallingSpeed_Flags Jump to SetFallingSpeed_Flags if any are set.
35139 LD (IY+19),9 Occasionally change the state of the object to 9.
SetFallingSpeed_Flags 35143 LD (IY+16),37 Set the flags of the object to 37.
35147 LD A,(IY+0) Fetch the type of the object.
35150 INC A Increment it.
35151 JP Z,FireShot_Sound Jump to FireShot_Sound if the slot is free.
35154 LD A,(35182) Count down the timer at 35182.
35157 DEC A
35158 LD (35182),A
35161 JR NZ,SetFallingSpeed_Accelerate Jump to SetFallingSpeed_Accelerate if it has not run out.
35163 LD A,(62957) Fetch the number of ships left from 62957.
35166 ADD A,A Multiply it by four...
35167 ADD A,A
35168 LD (35182),A ...and restart the timer.
35171 LD (IY+19),8 Change the state of the object to 8.
SetFallingSpeed_Accelerate 35175 LD (IY+15),32 Set the vertical acceleration of the object to 32.
35179 JP FireShot_Sound Jump to FireShot_Sound.
35182 DEFB 8
35183 DEFB 0
Prev: 35085 Up: Map Next: 35184