Prev: 875F Up: Map Next: 87A6
8787: Handle Pop
The handler for the pop (sprite IDs 6C to 6F) that is left when a creature is hit. The counter at offset 0E which was started at 10 by PopCreature, is counted down and the bottom two bits choose the frame of the animation. The pop is removed when the counter reaches zero.
Input
IX The pop entity
HandlerPop 8787 CALL StoreEntity Call StoreEntity to save the position of the pop.
878A LD A,($EA91) Fetch the room of the player from PlayerRoom.
878D CP (IX+$01) Jump to CountDownCreature if the pop is not in the same room as the player.
8790 JP NZ,CountDownCreature
8793 DEC (IX+$0E) Decrease the counter at offset 0E by one.
8796 JP Z,HandlerWeapon_Expire Jump to HandlerWeapon_Expire if it has reached zero, to remove the pop.
8799 LD A,(IX+$0E) Fetch the counter.
879C AND %00000011 Keep only bits 0-1.
879E ADD A,$6C Add 6C to get the sprite ID of the pop.
87A0 LD (IX+$00),A Update the sprite ID of the pop.
87A3 JP HandlerCharacter_Display Jump to HandlerCharacter_Display to display the pop.
Prev: 875F Up: Map Next: 87A6