Prev: 29863 Up: Map Next: 29910
29881: Animate Stunned Hazard
Animates the stunned hazard sequence. Used by the helicopter, cat, paratrooper, canopy and other hazards when hit by Percy's egg. Increments the animation counter until it reaches 133 cycling through animation frames. Assigns a random colour attribute and plays a hit sound each frame.
Input
IX Pointer to hazard sprite data
IY Pointer to hazard state data
Animate_Stunned_Hazard 29881 LD A,(IY+0) Return if the animation counter at *IY+0 has reached 133 (animation complete).
29884 CP 133
29886 RET Z
29887 INC A Increment the animation counter and write it back to *IY+0.
29888 LD (IY+0),A
29891 AND %01111111 Mask off bit 7, rotate right and add 54 to calculate the animation frame ID.
29893 RRCA
29894 ADD A,54
29896 LD (IX+3),A Write the frame ID to *IX+3.
29899 CALL Generate_Random_Number Generate a random number and mask with 7 to produce a random colour attribute.
29902 AND %00000111
29904 LD (IX+2),A Write the colour attribute to *IX+2.
29907 JP PlayHitSound Jump to PlayHitSound.
Prev: 29863 Up: Map Next: 29910