Prev: 35208 Up: Map Next: 35349
35309: Handle Devil
The handler for the devil (sprite IDs 120 to 123). 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 35309 CALL StoreEntity Call StoreEntity to save the position of the devil.
35312 CALL CheckPlayerTouch Call CheckPlayerTouch to check whether the entity is touching the player.
35315 DEC E Call TakeEnergyFromPlayer_Small if the devil touched the player.
35316 CALL Z,TakeEnergyFromPlayer_Small
35319 LD DE,(60051) Fetch the position of the player from 60051.
35323 CALL SteerCreature Call SteerCreature to steer the creature towards its target.
35326 LD A,(IX+0) Fetch the sprite ID of the devil.
35329 AND %11111100 Keep only bits 2-7.
35331 LD C,A Keep the base sprite ID in C.
35332 LD A,(24082) Fetch the counter from CounterLow.
35335 RRA Divide the counter by four.
35336 RRA
35337 AND %00000011 Keep only bits 0-1.
35339 ADD A,C Add the animation frame to the base sprite ID.
35340 LD (IX+0),A Update the sprite ID of the devil.
35343 LD DE,13364 DE=13364 (the area).
35346 JP HandlerBoss_Move Jump to HandlerBoss_Move to move the boss.
Prev: 35208 Up: Map Next: 35349