Prev: 35197 Up: Map Next: 35309
35208: Handle Frankenstein
The handler for Frankenstein (sprite IDs 116 to 119). He steers towards the player. If he touches the player while the player is holding the spanner (sprite ID 139 with attribute 69) then he is hit instead and the player is given 4096 points, otherwise TakeEnergyFromPlayer_Small takes some energy. The sprite comes from the bottom two bits of the counter at CounterLow. The tail at HandlerBoss_Move is also used by the other bosses.
Input
IX The Frankenstein entity
HandlerFrankenstein 35208 CALL StoreEntity Call StoreEntity to save the position of Frankenstein.
35211 CALL CheckPlayerTouch Call CheckPlayerTouch to check whether the entity is touching the player.
35214 DEC E Jump to HandlerFrankenstein_Steer if Frankenstein did not touch the player.
35215 JR NZ,HandlerFrankenstein_Steer
35217 LD DE,17803 DE=17803 (the attribute and the sprite ID of the spanner).
35220 CALL FindInventoryItem Call FindInventoryItem to look for the spanner in the inventory.
35223 JR NZ,HandlerFrankenstein_Hurt Jump to HandlerFrankenstein_Hurt if the player is not holding it.
35225 LD BC,4096 BC=4096 (the points to add to the score).
35228 CALL AddPointsToScore Call AddPointsToScore to add the points to the score.
35231 JP PopCreature Jump to PopCreature to turn the creature into a pop.
HandlerFrankenstein_Hurt 35234 CALL TakeEnergyFromPlayer_Small Call TakeEnergyFromPlayer_Small to take energy from the player.
HandlerFrankenstein_Steer 35237 LD DE,(60051) Fetch the position of the player from 60051.
35241 CALL SteerCreature Call SteerCreature to steer the creature towards its target.
35244 LD A,(24082) Fetch the counter from CounterLow.
35247 RRA Divide the counter by four.
35248 RRA
35249 AND %00000011 Keep only bits 0-1.
35251 ADD A,116 Add 116 to get the sprite ID of Frankenstein.
35253 LD (IX+0),A Update the sprite ID of Frankenstein.
35256 LD DE,13364 DE=13364 (the area).
This entry point is used by the routines at HandlerMummy, HandlerDracula and HandlerDevil.
The shared end of the handlers of the bosses. If the player is a character then the boss moves. If not, the boss moves away from the player.
HandlerBoss_Move 35259 LD A,(60048) Fetch the sprite ID of the player from Player.
35262 CP 49 Jump to MoveCreature if the player is a character.
35264 JP C,MoveCreature
35267 LD DE,(60051) Fetch the position of the player from 60051.
35271 CALL SteerCreature Call SteerCreature to steer the creature towards its target.
35274 LD A,(IX+8) Fetch the X velocity.
35277 NEG Reverse the direction of the X velocity.
35279 LD (IX+8),A Update the X velocity.
35282 LD C,A Keep the reversed X velocity in C.
35283 LD A,(IX+9) Fetch the Y velocity.
35286 NEG Reverse the direction of the Y velocity.
35288 LD (IX+9),A Update the Y velocity.
35291 LD DE,13364 DE=13364 (the area).
35294 AND C Jump to MoveCreature if the AND of the two velocities is not zero.
35295 JP NZ,MoveCreature
35298 LD (IX+8),1 Set the X velocity to 1.
35302 LD (IX+9),1 Set the Y velocity to 1.
35306 JP MoveCreature Jump to MoveCreature to move the creature.
Prev: 35197 Up: Map Next: 35309