Prev: 59474 Up: Map Next: 59520
59488: Increase Maroc's horizonal movement speed
Input
A Left/right controls flag, stored at 60157
C Maroc's current left/right (horizontal) speed, stored at 60164
Maroc's speed is increased/decreased in steps of 8 when keys are pressed. If the value is negative (value is > 128), Maroc is moving right. If the value is 0, Maroc is not moving horizontally, though he may be moving vertically.
A max speed of 32/-32 equates to Maroc moving 8 pixels per game cycle.
59488 CP 128 If bit 7 is set (value is > 128), Maroc is moving right
59490 JR NC,59496
59492 LD D,8 Increase Maroc's left movement speed by 8
59494 JR 59498
59496 LD D,248 Increase Maroc's right movement speed by 8
59498 LD A,C
59499 ADD A,D Add the above to Maroc's speed accordingly
Speed can't be greater than 32 (or less than 224 if Maroc is moving right), so limit speed to this value if it's gone over.
59500 CP 128 Is Maroc moving left or right?
59502 JR C,59512
Maroc is moving right - max speed check
59504 CP 224 Check if we've exceeded the maximum speed for this direction (< 224)
59506 JR NC,59518
59508 LD A,224 ...If so, set speed to maximum (224)
59510 JR 59518
Maroc is moving left - max speed check
59512 CP 32 Check if we've exceeded the maximum speed for this direction (> 32)
59514 JR C,59518
59516 LD A,32 ...If so, set speed to maximum (32)
59518 JR 59538 Jump to the end of the next routine to store the increased speed
Prev: 59474 Up: Map Next: 59520