![]() |
Routines |
| Prev: 40710 | Up: Map | Next: 40810 |
|
Handles the guardian (sprite IDs 148-149). Nothing happens unless the guardian is in the same room as the player.
Until all four pieces of the amulet have been collected (see 38669) the guardian is animated, and if it touches the player (see TestActorHurtingPlayer_Room) then the player is hit with a hit direction of 128 which makes the player fall straight down.
Once all four pieces have been collected the guardian steps aside to let the player past. It walks to the left if the X position of the player is 128 or more, but it does not move further left than 64. Otherwise it walks to the right, but it does not move further right than 191.
|
||||||||
| HandlerGuardian | 40726 | LD A,(38659) | Fetch the room of the player from 38659. | |||||
| 40729 | CP (IX+1) | Compare with the room of the guardian. | ||||||
| 40732 | RET NZ | Return if the guardian is in a different room. | ||||||
| 40733 | CALL StoreEntity | Remember the previous position of the guardian. | ||||||
| 40736 | LD A,(38669) | Fetch the amulet pieces collected from 38669. | ||||||
| 40739 | AND %00001111 | Keep only bits 0-3. | ||||||
| 40741 | CP 15 | Jump to HandlerGuardian_StepAside if all four amulet pieces have been collected. | ||||||
| 40743 | JR Z,HandlerGuardian_StepAside | |||||||
| 40745 | CALL AnimateRhino | Animate the guardian. | ||||||
| 40748 | LD BC,5903 | Set how far above and to the right of the guardian the player can be in BC to 5903. | ||||||
| 40751 | CALL TestActorHurtingPlayer_Room | Test whether the guardian is touching the player. | ||||||
| 40754 | JP NC,DisplayActor | Jump to DisplayActor to display the guardian if the player is not touching it. | ||||||
| 40757 | LD A,128 | Set the hit direction of the player in 38660 to 128. | ||||||
| 40759 | LD (38660),A | |||||||
| 40762 | CALL PlayWarbleSound | Play the warble sound. | ||||||
| 40765 | JP DisplayActor | Jump to DisplayActor to display the guardian. | ||||||
|
All four pieces have been collected. Walk to the left if the player is in the right half of the screen.
|
||||||||
| HandlerGuardian_StepAside | 40768 | LD A,(38661) | Fetch the X position of the player from 38661. | |||||
| 40771 | BIT 7,A | Jump to HandlerGuardian_Right if the player is in the left half of the screen. | ||||||
| 40773 | JR Z,HandlerGuardian_Right | |||||||
| 40775 | LD (IX+6),224 | Set the X velocity of the guardian to 224 (walking to the left). | ||||||
| 40779 | CALL MoveActor | Work out the new position of the guardian. | ||||||
| 40782 | LD A,E | Fetch the new X position of the guardian. | ||||||
| 40783 | CP 64 | Compare with 64. | ||||||
| HandlerGuardian_Limit | 40785 | JP C,DisplayActor | Jump to DisplayActor to display the guardian if it has reached the limit of its walk. | |||||
| 40788 | LD (IX+3),E | Set the new X position of the guardian. | ||||||
| 40791 | CALL AnimateRhino | Animate the guardian. | ||||||
| 40794 | JP DisplayActor | Jump to DisplayActor to display the guardian. | ||||||
|
Walk to the right.
|
||||||||
| HandlerGuardian_Right | 40797 | LD (IX+6),32 | Set the X velocity of the guardian to 32 (walking to the right). | |||||
| 40801 | CALL MoveActor | Work out the new position of the guardian. | ||||||
| 40804 | LD A,E | Fetch the new X position of the guardian. | ||||||
| 40805 | CP 192 | Compare with 192. | ||||||
| 40807 | CCF | Invert the carry flag. | ||||||
| 40808 | JR HandlerGuardian_Limit | Jump to HandlerGuardian_Limit. | ||||||
| Prev: 40710 | Up: Map | Next: 40810 |