SHARE
TWEET

Untitled

MSavioti Jul 19th, 2019 (edited) 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void LedgeGrabbing() {
  2.  
  3.         if (canLedgeGrab && !isHangingOnLedge && ledgeDetected && !isGrounded && yVelocity < 0 && !ceilingAbove && !grabLedgeCooldown) {
  4.             isHangingOnLedge = true;
  5.             canCrouch = false;
  6.             canMove = false;
  7.             canJump = false;
  8.             canChangeDirection = false;
  9.             playerBounds = upperCollider.bounds;
  10.             rb2d.gravityScale = 0;
  11.             rb2d.velocity = Vector2.zero;
  12.             upperCollider.enabled = false;
  13.             lowerCollider.enabled = false;
  14.             lastLedgeDropSpot = transform.position; //backup old position
  15.  
  16.             //move player pos to the ledge edge
  17.             transform.position = facingRight ? new Vector2(ledgeBounds.min.x, ledgeBounds.max.y) : new Vector2(ledgeBounds.max.x, ledgeBounds.max.y);
  18.             rb2d.velocity = Vector2.zero;
  19.             animator.Play("ledge_grab");
  20.  
  21.         }
  22.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top