![]() |
Routines |
| Prev: 25296 | Up: Map | Next: 25351 |
|
Used by the routine at MainGameLoop.
Update Percy's movement speed.
If the current input matches the previous input, accelerate up to a maximum of 4. If the input has changed, decelerate down to a minimum of 1.
|
||||
| UpdateMovementSpeed | 25304 | LD A,(24482) | Jump to UpdateMovementSpeed_Accelerate if *PreviousInputState is the same as *InputState. | |
| 25307 | LD C,A | |||
| 25308 | LD A,(24484) | |||
| 25311 | CP C | |||
| 25312 | JR Z,UpdateMovementSpeed_Accelerate | |||
|
Input changed so decelerate.
|
||||
| 25314 | LD A,(24494) | A=*MovementSpeed. | ||
| 25317 | CP 1 | Return if already at minimum speed (1). | ||
| 25319 | RET Z | |||
| 25320 | DEC A | Decrease speed by one. | ||
| 25321 | LD (24494),A | Write A to *MovementSpeed. | ||
| 25324 | RET | Return. | ||
|
Input is the same so accelerate.
|
||||
| UpdateMovementSpeed_Accelerate | 25325 | LD A,(24494) | A=*MovementSpeed. | |
| 25328 | CP 4 | Return if already at maximum speed (4). | ||
| 25330 | RET Z | |||
| 25331 | INC A | Increase speed by one. | ||
| 25332 | LD (24494),A | Write A to *MovementSpeed. | ||
| 25335 | RET | Return. | ||
|
This entry point is used by the routine at MainGameLoop.
No input so decelerate movement speed towards minimum.
|
||||
| UpdateMovementSpeed_Decelerate | 25336 | LD A,(24494) | A=*MovementSpeed. | |
| 25339 | CP 1 | Return if already at minimum speed (1). | ||
| 25341 | RET Z | |||
| 25342 | DEC A | Decrease speed by one. | ||
| 25343 | LD (24494),A | Write A to *MovementSpeed. | ||
| 25346 | LD A,(24484) | E=*PreviousInputState (use the previous direction for animation). | ||
| 25349 | LD E,A | |||
| 25350 | RET | Return. | ||
| Prev: 25296 | Up: Map | Next: 25351 |