![]() |
Routines |
| Prev: 35349 | Up: Map | Next: 35456 |
|
The handler for the witch (sprite IDs 144 to 147). The counter at offset 13 is counted down from 16 and when it reaches zero the witch gets a new random velocity (see RandomiseVelocity) with the Y velocity halved. The sprite faces right when the X velocity is not negative, and the bottom bit of the counter animates it. The movement itself is done by MoveCreature.
|
||||||||
| HandlerWitch | 35375 | CALL StoreEntity | Call StoreEntity to save the position of the witch. | |||||
| 35378 | LD A,(60049) | Fetch the room of the player from PlayerRoom. | ||||||
| 35381 | CP (IX+1) | Jump to CountDownCreature if the witch is not in the same room as the player. | ||||||
| 35384 | JP NZ,CountDownCreature | |||||||
| 35387 | LD HL,24101 | Point HL at the number of creatures at NumCreatures. | ||||||
| 35390 | INC (HL) | Increment the number of creatures by one. | ||||||
| 35391 | CALL CheckPlayerTouch | Call CheckPlayerTouch to check whether the entity is touching the player. | ||||||
| 35394 | DEC E | Jump to HandleTouchingCreature if the witch touched the player. | ||||||
| 35395 | JP Z,HandleTouchingCreature | |||||||
| 35398 | CALL CheckWeaponHit | Call CheckWeaponHit to check whether the weapon has hit the entity. | ||||||
| 35401 | DEC E | Jump to PopCreature if the witch was hit by a weapon. | ||||||
| 35402 | JP Z,PopCreature | |||||||
| 35405 | DEC (IX+13) | Decrease the counter at offset 13 by one. | ||||||
| 35408 | JR NZ,HandlerWitch_SetSprite | Jump to HandlerWitch_SetSprite if it is not zero. | ||||||
| 35410 | CALL RandomiseVelocity | Call RandomiseVelocity to give the creature a new random velocity. | ||||||
| 35413 | SRA (IX+9) | Halve the Y velocity, keeping its sign. | ||||||
| 35417 | LD (IX+13),16 | Set the counter to 16. | ||||||
|
Choose the sprite, which depends on the direction of travel and the counter.
|
||||||||
| HandlerWitch_SetSprite | 35421 | LD A,(IX+0) | Fetch the sprite ID of the witch. | |||||
| 35424 | AND %11111100 | Keep only bits 2-7. | ||||||
| 35426 | BIT 7,(IX+8) | Jump to HandlerWitch_Animate if the X velocity is negative. | ||||||
| 35430 | JR NZ,HandlerWitch_Animate | |||||||
| 35432 | ADD A,2 | Add 2 to use the sprites facing right. | ||||||
| HandlerWitch_Animate | 35434 | LD C,A | Keep the base sprite ID in C. | |||||
| 35435 | LD A,(IX+13) | Fetch the counter. | ||||||
| 35438 | RRA | Halve the counter. | ||||||
| 35439 | AND %00000001 | Keep only bit 0. | ||||||
| 35441 | ADD A,C | Add the animation frame to the base sprite ID. | ||||||
| 35442 | LD (IX+0),A | Update the sprite ID of the witch. | ||||||
| 35445 | LD DE,(24093) | Fetch the size of the room from CurrentRoom_Width. | ||||||
| 35449 | LD (IX+5),67 | Set the attribute of the entity to INK:MAGENTA, PAPER:BLACK (BRIGHT). | ||||||
| 35453 | JP MoveCreature | Jump to MoveCreature to move the creature. | ||||||
| Prev: 35349 | Up: Map | Next: 35456 |