.MovePlayer LDX currentPlayer \ Set X to the driver number of the current player ROR A \ If just one of the C flag and bit 7 of directionFacing EOR directionFacing \ is set (but not both), jump to play1 to move the car BMI play1 \ backwards along the track \ \ In other words, we move backwards if: \ \ * C is clear and the car is facing backwards along \ the track, in which case it is driving forwards \ but going backwards around the track \ \ * C is set and the car is facing forwards along the \ track, in which case it is reversing along the \ track while facing forwards JSR MoveObjectForward \ Move the current player forwards by one segment RTS \ Return from the subroutine .play1 JSR MoveObjectBack \ Move current player backwards by one segment RTS \ Return from the subroutineName: MovePlayer [Show more] Type: Subroutine Category: Car geometry Summary: Move the player's car forwards or backwards by one segmentContext: See this subroutine in context in the source code References: This subroutine is called as follows: * MovePlayerBack calls MovePlayer * MovePlayerForward calls MovePlayer
Arguments: C flag Controls the direction of movement: * Clear = move the car in the direction it is pointing (i.e. drive forwards) * Set = reverse the car
[X]
Subroutine MoveObjectBack (category: 3D objects)
Move a specified object backwards along the track by one segment
[X]
Subroutine MoveObjectForward (category: 3D objects)
Move a specified object forwards along the track by one segment
[X]
Variable currentPlayer in workspace Zero page
The number of the current player
[X]
Variable directionFacing in workspace Zero page
The direction that our car is facing
[X]
Label play1 is local to this routine