This prevents the player from skidding around by resetting the speed to 0. xSpeed = 0; ySpeed = 0; xSpeed and ySpeed will be determined later in the End Step, and xSpeedRemainder and ySpeedRemainder will be used to keep a running total of the speed remainders.