Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //If the player is stuck to a wall and is supposed to still be stuck to the wall
- if (timeToWallUnstick > 0 && stuckToWall) {
- //If the player hasnt landed yet
- if (!characterController.isGrounded) {
- //Make the player fall at half gravity
- speed.y = verticalVelocity / 2;
- //make sure the player cant leave the wall
- speed -= forbiddenMove;
- }
- /*
- Tick down the time the player has to be "stuck" to the wall
- (counts down from a preset value of 0.25 of a second)
- */
- timeToWallUnstick -= Time.deltaTime;
- /*
- Make sure to have some leway so the player can perform the double jump
- even though they might have left the wall a few fractions of a second
- */
- timeToWalljumpleway -= Time.deltaTime;
- } else {
- /*
- If the player isnt supposed to be stuck to the wall anymore, like if
- the timer has run out. make sure to "unstick" from the wall and reset
- the timer back to its original value (0.25 of a second)
- */
- timeToWallUnstick = wallStickTime;
- stuckToWall = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement