![]() |
Routines |
| Prev: 35375 | Up: Map | Next: 35547 |
|
The handler for the monk (sprite IDs 148 to 151) and the second kind of bat (152 to 155). It is the same as HandlerWitch, but the counter is restarted at 32 and when it runs out the X velocity is also set to -2 or 2 depending on the bottom bit of FRAMES. The attribute is INK:RED, PAPER:BLACK (BRIGHT).
|
||||||||
| HandlerMonk | 35456 | CALL StoreEntity | Call StoreEntity to save the position of the creature. | |||||
| 35459 | LD A,(60049) | Fetch the room of the player from PlayerRoom. | ||||||
| 35462 | CP (IX+1) | Jump to CountDownCreature if the creature is not in the same room as the player. | ||||||
| 35465 | JP NZ,CountDownCreature | |||||||
| 35468 | LD HL,24101 | Point HL at the number of creatures at NumCreatures. | ||||||
| 35471 | INC (HL) | Increment the number of creatures by one. | ||||||
| 35472 | CALL CheckPlayerTouch | Call CheckPlayerTouch to check whether the entity is touching the player. | ||||||
| 35475 | DEC E | Jump to HandleTouchingCreature if the creature touched the player. | ||||||
| 35476 | JP Z,HandleTouchingCreature | |||||||
| 35479 | CALL CheckWeaponHit | Call CheckWeaponHit to check whether the weapon has hit the entity. | ||||||
| 35482 | DEC E | Jump to PopCreature if the creature was hit by a weapon. | ||||||
| 35483 | JP Z,PopCreature | |||||||
| 35486 | DEC (IX+13) | Decrease the counter at offset 13 by one. | ||||||
| 35489 | JR NZ,HandlerMonk_SetSprite | Jump to HandlerMonk_SetSprite if it is not zero. | ||||||
| 35491 | CALL RandomiseVelocity | Call RandomiseVelocity to give the creature a new random velocity. | ||||||
| 35494 | LD A,(23672) | Fetch the low byte of FRAMES. | ||||||
| 35497 | AND %00000100 | Keep only bit 2. | ||||||
| 35499 | SUB 2 | Subtract 2 giving -2 or 2. | ||||||
| 35501 | LD (IX+8),A | Update the X velocity of the creature. | ||||||
| 35504 | SRA (IX+9) | Halve the Y velocity, keeping its sign. | ||||||
| 35508 | LD (IX+13),32 | Set the counter to 32. | ||||||
| HandlerMonk_SetSprite | 35512 | LD A,(IX+0) | Fetch the sprite ID of the creature. | |||||
| 35515 | AND %11111100 | Keep only bits 2-7. | ||||||
| 35517 | BIT 7,(IX+8) | Jump to HandlerMonk_Animate if the X velocity is negative. | ||||||
| 35521 | JR NZ,HandlerMonk_Animate | |||||||
| 35523 | ADD A,2 | Add 2 to use the sprites facing right. | ||||||
| HandlerMonk_Animate | 35525 | LD C,A | Keep the base sprite ID in C. | |||||
| 35526 | LD A,(IX+13) | Fetch the counter. | ||||||
| 35529 | RRA | Halve the counter. | ||||||
| 35530 | AND %00000001 | Keep only bit 0. | ||||||
| 35532 | ADD A,C | Add the animation frame to the base sprite ID. | ||||||
| 35533 | LD (IX+0),A | Update the sprite ID of the creature. | ||||||
| 35536 | LD DE,(24093) | Fetch the size of the room from CurrentRoom_Width. | ||||||
| 35540 | LD (IX+5),66 | Set the attribute of the entity to INK:RED, PAPER:BLACK (BRIGHT). | ||||||
| 35544 | JP MoveCreature | Jump to MoveCreature to move the creature. | ||||||
| Prev: 35375 | Up: Map | Next: 35547 |