Prev: 8988 Up: Map Next: 8A15
89ED: Handle Devil
The handler for the devil (sprite IDs 78 to 7B). If the devil touches the player then TakeEnergyFromPlayer_Small takes some energy. The devil always steers towards the player. The sprite comes from the bottom two bits of the counter at CounterLow, and then HandlerBoss_Move does the rest.
Input
IX The devil entity
HandlerDevil 89ED CALL StoreEntity Call StoreEntity to save the position of the devil.
89F0 CALL CheckPlayerTouch Call CheckPlayerTouch to check whether the entity is touching the player.
89F3 DEC E Call TakeEnergyFromPlayer_Small if the devil touched the player.
89F4 CALL Z,TakeEnergyFromPlayer_Small
89F7 LD DE,($EA93) Fetch the position of the player from EA93.
89FB CALL SteerCreature Call SteerCreature to steer the creature towards its target.
89FE LD A,(IX+$00) Fetch the sprite ID of the devil.
8A01 AND %11111100 Keep only bits 2-7.
8A03 LD C,A Keep the base sprite ID in C.
8A04 LD A,($5E12) Fetch the counter from CounterLow.
8A07 RRA Divide the counter by four.
8A08 RRA
8A09 AND %00000011 Keep only bits 0-1.
8A0B ADD A,C Add the animation frame to the base sprite ID.
8A0C LD (IX+$00),A Update the sprite ID of the devil.
8A0F LD DE,$3434 DE=3434 (the area).
8A12 JP HandlerBoss_Move Jump to HandlerBoss_Move to move the boss.
Prev: 8988 Up: Map Next: 8A15