Prev: 59541 Up: Map Next: 59584
59552: Increase Maroc's vertical movement speed
Input
A Up/down controls flag, stored at 60158
C Maroc's current up/down (vertical) speed, stored at 60165
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 down. If the value is 0, Maroc is not moving vertically, though he may be moving horizontally.
A max speed of 32/-32 equates to Maroc moving 8 pixels per game cycle.
59552 CP 128 If bit 7 is set (value is > 128), Maroc is moving down
59554 JR NC,59560
59556 LD D,8 Increase Maroc's up movement speed by 8
59558 JR 59562
59560 LD D,248 Increase Maroc's down movement speed by 8
59562 LD A,C Add the above to Maroc's speed accordingly
59563 ADD A,D
Speed can't be greater than 32 (or less than 224 if Maroc is moving down), so limit speed to this value if it's gone over.
59564 CP 128 Is Maroc's moving up or down?
59566 JR C,59576
Maroc is moving down - max speed check:
59568 CP 224 Check if we've exceeded the maximum speed for this direction (< 224)
59570 JR NC,59582
59572 LD A,224 ...If so, set speed to maximum (224)
59574 JR 59582
Maroc is moving up - max speed check:
59576 CP 32 Check if we've exceeded the maximum speed for this direction (> 32)
59578 JR C,59582
59580 LD A,32 ...If so, set speed to maximum (32)
59582 JR 59602 Jump to the end of the next routine to store the increased speed
Prev: 59541 Up: Map Next: 59584