Prev: 47011 Up: Map Next: 47079
47017: Handle Spiked Ball
Handles a spiked ball. It hangs in the air until, one time in sixteen, it is chosen to drop (only one ball drops at a time), and then it falls to the floor and stays there. Nothing happens while the balls are not allowed to drop.
Input
IX Address of the spiked ball object
HandleSpikedBall 47017 CALL SetDeadlyFlags Make the spiked ball deadly.
47020 CALL SetPixelAdjustments_Block Set the pixel adjustments of a spiked ball.
Hang in the air until this ball is chosen to drop.
47023 LD A,(23488) Fetch the flag that stops the balls from dropping from SpikedBallHoldFlag.
47026 AND A Test it.
47027 RET NZ Return if the balls may not drop.
47028 BIT 2,(IX+13) Jump to HandleSpikedBall_Drop if this ball is dropping.
47032 JR NZ,HandleSpikedBall_Drop
47034 LD HL,23487 Point HL at SpikedBallDroppingFlag.
47037 LD A,(HL) Fetch it.
47038 AND A Test it.
47039 RET NZ Return if another ball is dropping.
47040 LD A,(23461) Fetch the second random seed from RandomSeed2.
47043 CP 16 Compare it with 16 for a one in sixteen chance.
47045 RET NC Return if it is not that time.
47046 SET 2,(IX+13) Flag this ball as dropping.
47050 LD (HL),1 Flag that a ball is dropping.
47052 RET Return.
Make the ball fall.
HandleSpikedBall_Drop 47053 CALL ApplyGravityAndMove Apply gravity to the ball and move it.
47056 BIT 2,(IX+12) Jump to HandleSpikedBall_Landed if the ball has hit the floor.
47060 JR NZ,HandleSpikedBall_Landed
47062 CALL PlaySoundFromHeight Play the sound of a falling object.
HandleSpikedBall_Draw 47065 JP SetWipeAndDrawFlags Flag the ball to be drawn again.
HandleSpikedBall_Landed 47068 RES 2,(IX+13) Flag this ball as no longer dropping.
47072 LD HL,23487 Point HL at SpikedBallDroppingFlag.
47075 LD (HL),0 Flag that no ball is dropping.
47077 JR HandleSpikedBall_Draw Jump to HandleSpikedBall_Draw.
View the equivalent code in;
Prev: 47011 Up: Map Next: 47079