Prev: 24553 Up: Map Next: 25250
25216: Move Percy Left
Used by the routine at MainGameLoop.
Move Percy left. Checks screen boundary and handles room transitions.
Input
IX Pointer to Percy's state data
D Number of pixels to move
MovePercyLeft 25216 LD A,1 Write 1 to *PercyFacingDirection (Percy is facing left).
25218 LD (24485),A
If *CarryingWormFlag is set, apply an extra boundary check.
25221 LD A,(24490) Jump to MovePercyLeft_Apply if *CarryingWormFlag is set.
25224 OR A
25225 JR Z,MovePercyLeft_Apply
25227 LD A,(IX+0) Load A with Percy's X position (*IX+0) - 5.
25230 SUB 5
If Percy has gone past the left edge transition into the previous room.
25232 JP C,TransitionRoomLeft Jump to TransitionRoomLeft if Percy's new position is less than 0 (transition to the previous room).
25235 SUB D Subtract the movement speed from Percy's X position.
25236 JP C,TransitionRoomLeft Jump to TransitionRoomLeft if Percy's new position is less than 0 (transition to the previous room).
MovePercyLeft_Apply 25239 LD A,(IX+0) Load A with Percy's X position (*IX+0) - the number of pixels to move (from D).
25242 SUB D
If Percy has gone past the left edge transition into the previous room.
25243 JP C,TransitionRoomLeft Jump to TransitionRoomLeft if Percy's new position is less than 0 (transition to the previous room).
25246 LD (IX+0),A Write Percy's updated X screen position back to *IX+0.
25249 RET Return.
Prev: 24553 Up: Map Next: 25250