![]() |
Routines |
| Prev: 44479 | Up: Map | Next: 44596 |
|
Handles the player while they are attacking with the sword (sprite IDs 32 to 47). Bit 3 of the sprite ID is set when the player is attacking to the right.
While the player is holding down "fire" they can move about with a fixed speed in any direction. When "fire" is released, or if the player has an orchid effect, the player is made to walk again by StopAttack. If the player has been hit (the hit direction in IX+2 is not zero) then they are knocked back by KnockPlayerBack.
|
||||||||
| PlayerMovement | 44496 | CALL StoreEntity | Remember the previous position of the player. | |||||
| 44499 | CALL TestPlayerProgress | Check the progress of the player. | ||||||
| 44502 | LD A,16 | Set the width of the player in Actor_Width to 16. | ||||||
| 44504 | LD (38573),A | |||||||
| 44507 | LD A,(IX+2) | Fetch the hit direction of the player. | ||||||
| 44510 | AND A | Jump to KnockPlayerBack if the player has been hit. | ||||||
| 44511 | JP NZ,KnockPlayerBack | |||||||
|
Initialise the player movement (0000 == no movement).
|
||||||||
| 44514 | LD DE,0 | Clear the movement of the player in DE. | ||||||
|
Read the controls.
|
||||||||
| 44517 | CALL HandlerControls | Read the controls. | ||||||
|
Check if the player is under the influence of an orchid.
|
||||||||
| 44520 | LD A,(IX+5) | Fetch the colour of the player. | ||||||
| 44523 | CP 71 | Jump to StopAttack if the player is not using attribute INK:WHITE, PAPER:BLACK (BRIGHT). | ||||||
| 44525 | JR NZ,StopAttack | |||||||
|
Check that "fire" is still being pressed.
|
||||||||
| 44527 | BIT 4,C | Jump to StopAttack if "fire" is not being pressed. | ||||||
| 44529 | JR Z,StopAttack | |||||||
|
Handle "right".
|
||||||||
| 44531 | BIT 1,C | Jump to PlayerMovement_Left if "right" is not being pressed. | ||||||
| 44533 | JR Z,PlayerMovement_Left | |||||||
| 44535 | LD A,E | Add 32 to the X movement in E. | ||||||
| 44536 | ADD A,32 | |||||||
| 44538 | LD E,A | |||||||
|
Handle "left".
|
||||||||
| PlayerMovement_Left | 44539 | BIT 0,C | Jump to PlayerMovement_Up if "left" is not being pressed. | |||||
| 44541 | JR Z,PlayerMovement_Up | |||||||
| 44543 | LD A,E | Subtract 32 from the X movement in E. | ||||||
| 44544 | SUB 32 | |||||||
| 44546 | LD E,A | |||||||
|
Handle "up".
|
||||||||
| PlayerMovement_Up | 44547 | BIT 2,C | Jump to PlayerMovement_Down if "up" is not being pressed. | |||||
| 44549 | JR Z,PlayerMovement_Down | |||||||
| 44551 | LD A,D | Subtract 32 from the Y movement in D. | ||||||
| 44552 | SUB 32 | |||||||
| 44554 | LD D,A | |||||||
|
Handle "down".
|
||||||||
| PlayerMovement_Down | 44555 | BIT 3,C | Jump to PlayerMovement_Move if "down" is not being pressed. | |||||
| 44557 | JR Z,PlayerMovement_Move | |||||||
| 44559 | LD A,D | Add 32 to the Y movement in D. | ||||||
| 44560 | ADD A,32 | |||||||
| 44562 | LD D,A | |||||||
|
Update the player actor record and move the player.
|
||||||||
| PlayerMovement_Move | 44563 | LD (IX+6),E | Set the X velocity of the player. | |||||
| 44566 | LD (IX+7),D | Set the Y velocity of the player. | ||||||
| 44569 | CALL MoveActor | Work out the new position of the player. | ||||||
| 44572 | LD BC,5646 | Set the height of the player in B to 22 and the width in C to 14. | ||||||
| 44575 | CALL SlideActorPastObjects | Stop the player passing through objects in the room. | ||||||
| 44578 | CALL AnimateAttack | Animate the attacking player. | ||||||
| 44581 | CALL TestPositionUnchanged | Test whether the player has stayed where it was. | ||||||
| 44584 | LD (IX+3),E | Set the X position of the player. | ||||||
| 44587 | LD (IX+4),D | Set the Y position of the player. | ||||||
| 44590 | CALL NZ,PlayFootstepSound | Play the footstep sound if the player moved. | ||||||
| 44593 | JP DisplayActor | Jump to DisplayActor to display the player. | ||||||
| Prev: 44479 | Up: Map | Next: 44596 |