![]() |
Routines |
| Prev: 50643 | Up: Map | Next: 50794 |
|
Used by the routine at HandlePlayerLegs.
Moves the player by one frame. The speeds along x and y are only set up while the player walks, is jumping or is entering the room, and they are cleared again afterwards. The speed along z has gravity taken off it, which is more if the player is not rising with the jump control held down. If the player lands the jump is over.
|
||||||||||
|
Set the walk speeds unless the player is turning.
|
||||||||||
| MovePlayer | 50717 | BIT 3,(IX+12) | Jump to MovePlayer_Walk to walk if the player is jumping. | |||||||
| 50721 | JR NZ,MovePlayer_Walk | |||||||||
| 50723 | LD A,(IX+12) | Fetch the collision flags. | ||||||||
| 50726 | AND %11110000 | Keep only the countdown from entering the room. | ||||||||
| 50728 | JR NZ,MovePlayer_Walk | Jump to MovePlayer_Walk to walk if the player has just entered the room. | ||||||||
| 50730 | BIT 2,C | Jump to MovePlayer_Gravity if the player is not walking. | ||||||||
| 50732 | JR Z,MovePlayer_Gravity | |||||||||
| MovePlayer_Walk | 50734 | PUSH BC | Stash the controls on the stack. | |||||||
| 50735 | CALL SetPlayerSpeed | Call SetPlayerSpeed to give the player a speed along x or y. | ||||||||
| 50738 | POP BC | Restore the controls from the stack. | ||||||||
|
Gravity takes one off the speed along z when the player is rising with the jump control held down, and two otherwise.
|
||||||||||
| MovePlayer_Gravity | 50739 | LD A,(IX+11) | Fetch the speed along the z axis. | |||||||
| 50742 | AND A | Jump to MovePlayer_GravityFalling if the player is falling. | ||||||||
| 50743 | JP M,MovePlayer_GravityFalling | |||||||||
| 50746 | BIT 3,C | Jump to MovePlayer_GravityApply if the jump key is held down. | ||||||||
| 50748 | JR NZ,MovePlayer_GravityApply | |||||||||
| MovePlayer_GravityFalling | 50750 | DEC A | Decrement A. | |||||||
| MovePlayer_GravityApply | 50751 | DEC A | Decrement A. | |||||||
| 50752 | LD (IX+11),A | Store the speed along the z axis. | ||||||||
| 50755 | LD (42809),A | Set PreviousVerticalSpeed. | ||||||||
| 50758 | ADD A,2 | Add 2. | ||||||||
| 50760 | CALL BlockMovement | Call BlockMovement to move the object, as far as it can go. | ||||||||
| 50763 | CALL DoNothing | Call DoNothing. | ||||||||
| 50766 | CALL ApplyGravityAndMove_AddSpeeds | Call ApplyGravityAndMove_AddSpeeds to add the distances that the player moved to the position of the player. | ||||||||
|
Clear the jump flag when the player lands from a fall.
|
||||||||||
| 50769 | BIT 2,(IX+12) | Jump to MovePlayer_Done if the player is not on the ground. | ||||||||
| 50773 | JR Z,MovePlayer_Done | |||||||||
| 50775 | LD A,(42809) | Fetch PreviousVerticalSpeed. | ||||||||
| 50778 | AND A | Jump to MovePlayer_Done if the player was not falling. | ||||||||
| 50779 | JP P,MovePlayer_Done | |||||||||
| 50782 | RES 3,(IX+12) | Clear the flag for jumping, as the player has landed. | ||||||||
|
Clear the speeds along x and y.
|
||||||||||
| MovePlayer_Done | 50786 | XOR A | Write 0 to the speeds along x and y. | |||||||
| 50787 | LD (IX+9),A | |||||||||
| 50790 | LD (IX+10),A | |||||||||
| 50793 | RET | Return. | ||||||||
|
View the equivalent code in;
|
||||||||||
| Prev: 50643 | Up: Map | Next: 50794 |