Routines |
Prev: E895 | Up: Map | Next: E8C0 |
|
||||||||||
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.
|
||||||||||
E8A0 | CP $80 | If bit 7 is set (value is > 128), Maroc is moving down | ||||||||
E8A2 | JR NC,$E8A8 | |||||||||
E8A4 | LD D,$08 | Increase Maroc's up movement speed by 8 | ||||||||
E8A6 | JR $E8AA | |||||||||
E8A8 | LD D,$F8 | Increase Maroc's down movement speed by 8 | ||||||||
E8AA | LD A,C | Add the above to Maroc's speed accordingly | ||||||||
E8AB | 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.
|
||||||||||
E8AC | CP $80 | Is Maroc's moving up or down? | ||||||||
E8AE | JR C,$E8B8 | |||||||||
Maroc is moving down - max speed check:
|
||||||||||
E8B0 | CP $E0 | Check if we've exceeded the maximum speed for this direction (< 224) | ||||||||
E8B2 | JR NC,$E8BE | |||||||||
E8B4 | LD A,$E0 | ...If so, set speed to maximum (224) | ||||||||
E8B6 | JR $E8BE | |||||||||
Maroc is moving up - max speed check:
|
||||||||||
E8B8 | CP $20 | Check if we've exceeded the maximum speed for this direction (> 32) | ||||||||
E8BA | JR C,$E8BE | |||||||||
E8BC | LD A,$20 | ...If so, set speed to maximum (32) | ||||||||
E8BE | JR $E8D2 | Jump to the end of the next routine to store the increased speed |
Prev: E895 | Up: Map | Next: E8C0 |