Prev: 65C8 Up: Map Next: 6607
65E8: Handle Explosion
The handler for the explosion (IDs 26 and 27) which is shown when a flour shot ends. The sprite is chosen by the lowest bit of a counter in byte 07 of the actor, which starts at 03 and counts down to zero.
The sprite is drawn each time without the previous one being erased. As the sprites are drawn using exclusive OR, drawing the two frames in turn leaves the screen blank after the fourth time, so the explosion is removed when the counter reaches zero.
Input
IX Actor
HandleExplosion 65E8 LD A,(IX+$07) Fetch the explosion counter.
65EB AND %00000001 Keep only bit 0 (which of the two frames of the explosion to show).
65ED ADD A,$26 Add 26 to get the ID of the frame.
65EF LD (IX+$00),A Set the actor ID to the ID of the frame.
65F2 CALL DrawEntity Draw the explosion using DrawEntity.
65F5 CALL ColourSprite Colour the sprite using ColourSprite.
65F8 LD A,(IX+$07) Fetch the explosion counter.
65FB AND A Has the explosion finished (is the counter zero)?
65FC JR Z,HandleExplosion_Remove Jump to HandleExplosion_Remove if it has.
65FE DEC (IX+$07) Decrease the explosion counter by one.
6601 RET Return.
HandleExplosion_Remove 6602 LD (IX+$00),$00 Remove the explosion by writing 00 to the actor ID.
6606 RET Return.
Prev: 65C8 Up: Map Next: 6607