void Update() { if (!keyDisabled) { moveHorizontal = Input.GetAxis("Horizontal"); if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W)) { moveVertical = true; } } // Only allowing player to move away from wall- NEEDS WORK int test = groundWallChecks.WallDirection(); if (test == -1 && moveHorizontal < 0) { moveHorizontal = 0; } else if (test == 1 && moveHorizontal > 0) { moveHorizontal = 0; } // press shift to run when on the ground if (Input.GetKey(KeyCode.LeftShift) && groundWallChecks.IsGround()) //TODO When jumping in air and let go of shift, it slows down { maxSpeed = 15f; } else { maxSpeed = 10f; } //changing animation if on the ground if (groundWallChecks.IsGround()) { animator.SetBool("Grounded", true); } // flips char sprite when changing direction if ((moveHorizontal > 0 && !facingRight) || (moveHorizontal < 0 && facingRight)) { Flip(); } }
void Update() { if (groundWallChecks.IsGround()) { moveDown = false; //shakes camera if close enough CheckCameraDistance(); } if (checkPosition()) { moveDown = true; } }