![]() |
Routines |
| Prev: 8A2F | Up: Map | Next: 8ADB |
|
The handler for the monk (sprite IDs 94 to 97) and the second kind of bat (98 to 9B). It is the same as HandlerWitch, but the counter is restarted at 20 and when it runs out the X velocity is also set to -02 or 02 depending on the bottom bit of FRAMES. The attribute is INK:RED, PAPER:BLACK (BRIGHT).
|
||||||||
| HandlerMonk | 8A80 | CALL StoreEntity | Call StoreEntity to save the position of the creature. | |||||
| 8A83 | LD A,($EA91) | Fetch the room of the player from PlayerRoom. | ||||||
| 8A86 | CP (IX+$01) | Jump to CountDownCreature if the creature is not in the same room as the player. | ||||||
| 8A89 | JP NZ,CountDownCreature | |||||||
| 8A8C | LD HL,$5E25 | Point HL at the number of creatures at NumCreatures. | ||||||
| 8A8F | INC (HL) | Increment the number of creatures by one. | ||||||
| 8A90 | CALL CheckPlayerTouch | Call CheckPlayerTouch to check whether the entity is touching the player. | ||||||
| 8A93 | DEC E | Jump to HandleTouchingCreature if the creature touched the player. | ||||||
| 8A94 | JP Z,HandleTouchingCreature | |||||||
| 8A97 | CALL CheckWeaponHit | Call CheckWeaponHit to check whether the weapon has hit the entity. | ||||||
| 8A9A | DEC E | Jump to PopCreature if the creature was hit by a weapon. | ||||||
| 8A9B | JP Z,PopCreature | |||||||
| 8A9E | DEC (IX+$0D) | Decrease the counter at offset 0D by one. | ||||||
| 8AA1 | JR NZ,HandlerMonk_SetSprite | Jump to HandlerMonk_SetSprite if it is not zero. | ||||||
| 8AA3 | CALL RandomiseVelocity | Call RandomiseVelocity to give the creature a new random velocity. | ||||||
| 8AA6 | LD A,($5C78) | Fetch the low byte of FRAMES. | ||||||
| 8AA9 | AND %00000100 | Keep only bit 2. | ||||||
| 8AAB | SUB $02 | Subtract 02 giving -02 or 02. | ||||||
| 8AAD | LD (IX+$08),A | Update the X velocity of the creature. | ||||||
| 8AB0 | SRA (IX+$09) | Halve the Y velocity, keeping its sign. | ||||||
| 8AB4 | LD (IX+$0D),$20 | Set the counter to 20. | ||||||
| HandlerMonk_SetSprite | 8AB8 | LD A,(IX+$00) | Fetch the sprite ID of the creature. | |||||
| 8ABB | AND %11111100 | Keep only bits 2-7. | ||||||
| 8ABD | BIT 7,(IX+$08) | Jump to HandlerMonk_Animate if the X velocity is negative. | ||||||
| 8AC1 | JR NZ,HandlerMonk_Animate | |||||||
| 8AC3 | ADD A,$02 | Add 02 to use the sprites facing right. | ||||||
| HandlerMonk_Animate | 8AC5 | LD C,A | Keep the base sprite ID in C. | |||||
| 8AC6 | LD A,(IX+$0D) | Fetch the counter. | ||||||
| 8AC9 | RRA | Halve the counter. | ||||||
| 8ACA | AND %00000001 | Keep only bit 0. | ||||||
| 8ACC | ADD A,C | Add the animation frame to the base sprite ID. | ||||||
| 8ACD | LD (IX+$00),A | Update the sprite ID of the creature. | ||||||
| 8AD0 | LD DE,($5E1D) | Fetch the size of the room from CurrentRoom_Width. | ||||||
| 8AD4 | LD (IX+$05),$42 | Set the attribute of the entity to INK:RED, PAPER:BLACK (BRIGHT). | ||||||
| 8AD8 | JP MoveCreature | Jump to MoveCreature to move the creature. | ||||||
| Prev: 8A2F | Up: Map | Next: 8ADB |