// ****************** // * START MOVEMENT * // ****************** /// <summary> /// Handles all of the movement for the Shoes. /// </summary> /// <param name="gameTime">Snapshot of the game timing state.</param> /// <param name="guy">A reference to the Guy.</param> private void handleMovement(GameTime gameTime, ref Guy guy) { float delta = (float)gameTime.ElapsedGameTime.TotalSeconds; // Represents the amount of time that has passed since the previous frame. newKeyboardState = Keyboard.GetState(); // Get the new state of the keyboard. // Handles delaying movement after the Shoes have collided with a Spring. stopDelayingMovementAfterSpringCollisionIfPossible(); // Set the horizontal velocity based on if the Shoes are on the ground or in the air. setHorizontalVelocity(); // Check to see if the player wants to jump. If so, set the vertical velocity appropriately. checkIfShoesWantToJump(guy.tileAbove()); // Move the Shoes if the player has pressed the appropriate key. moveShoesLeftOrRightIfPossible(delta); // Have the Shoes ascend from jumping if they haven't started falling yet. haveShoesAscendFromJumpOrFallFromGravity(delta); // If the Shoes have collided with a Spring, then apply movement from the Spring over time. checkIfShoesCanBounceFromSpring(delta); // If the Shoes have collided with a Launcher and are ready to be launched, then apply movement from the Launcher over time. checkIfShoesCanLaunch(guy.powerOfLauncherBeingUsed); // If the Shoes have fallen to the bottom of the map, reset the Shoes and Guy to the starting position of the level. resetShoesAndGuyToLevelStartingPositionIfNecessary(guy); // Update timers. updateTimers(gameTime); // Get the old state of the keyboard. //oldKeyboardState = newKeyboardState; // Commented out so the interface works. }