Prev: 60051 Up: Map Next: 60233
60165: Player: Move Right
Used by the routines at PlayerControls_Kempston and PlayerControls.
Input
IX On entry will be set to TablePlayerAttributes
PlayerMoveRight 60165 LD A,(IX+17) Return if *PlayerActionState is blocked / no walk.
60168 CP 2
60170 RET Z
60171 CP 3 Jump to PlayerMoveRight_FaceAndWalk if *PlayerActionState is not on a ladder.
60173 JR NZ,PlayerMoveRight_FaceAndWalk
60175 LD A,(IX+3) Return if *PlayerVerticalPosition is not 3.
60178 CP 3
60180 RET NZ
60181 LD A,255 Force *PlayerCollisionMask_Middle so the middle foot does not see a floor.
60183 LD (62253),A
60186 LD A,(IX+1) Jump to PlayerMoveRight_FaceAndWalk if *PlayerVerticalCoordinate is at the top of the ladder.
60189 CP (IX+18)
60192 JR Z,PlayerMoveRight_FaceAndWalk
60194 CP (IX+19) Return if *PlayerVerticalCoordinate is not at the bottom of the ladder.
60197 RET NZ
Face and walk right.
PlayerMoveRight_FaceAndWalk 60198 LD A,(IX+17) Jump to PlayerMoveRight_AdvanceFrame if *PlayerActionState is already facing right.
60201 CP 19
60203 JR Z,PlayerMoveRight_AdvanceFrame
60205 LD (IX+17),19 Set *PlayerActionState to facing right.
60209 LD (IX+6),26 Write the frame before the first right-facing walk sprite to *PlayerSpriteID.
PlayerMoveRight_AdvanceFrame 60213 LD A,(IX+6) A=*PlayerSpriteID.
60216 ADD A,6 Advance to the next right-facing walk frame.
60218 LD (IX+6),A Write it back to *PlayerSpriteID.
60221 CP 80 Jump to PlayerMoveRight_SetDirection if the walk cycle has not wrapped.
60223 JR NZ,PlayerMoveRight_SetDirection
60225 LD (IX+6),32 Reset *PlayerSpriteID to the first right-facing frame.
PlayerMoveRight_SetDirection 60229 DEC (IX+4) Set *PlayerHorizontalMovement to move right.
60232 RET Return.
Prev: 60051 Up: Map Next: 60233