made some changes to double jump
This commit is contained in:
		@@ -171,7 +171,7 @@ public class PlayerBehavior : MonoBehaviour
 | 
			
		||||
        }
 | 
			
		||||
        else if (col.tag == "Trumpet")
 | 
			
		||||
        {
 | 
			
		||||
            this.playerController.in_range = true;
 | 
			
		||||
            this.playerController.in_range = false;
 | 
			
		||||
            this.playerController.enemy = null;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -29,8 +29,8 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
    public float LastOnWallTime { get; private set; }
 | 
			
		||||
    public float LastOnWallRightTime { get; private set; }
 | 
			
		||||
    public float LastOnWallLeftTime { get; private set; }
 | 
			
		||||
    
 | 
			
		||||
    private bool trumpet = false;
 | 
			
		||||
 | 
			
		||||
    public int trumpet = 0;
 | 
			
		||||
    public bool in_range = false;
 | 
			
		||||
    public GameObject enemy;
 | 
			
		||||
 | 
			
		||||
@@ -97,9 +97,12 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
            CheckDirectionToFace(_moveInput.x > 0);
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        if (!IsJumping) {
 | 
			
		||||
        if (!IsJumping)
 | 
			
		||||
        {
 | 
			
		||||
            print("not jumping");
 | 
			
		||||
        } else {
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            print("jumping, " + RB.velocity.y);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -110,7 +113,7 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
            if (IsGrounded()) //checks if set box overlaps with ground
 | 
			
		||||
            {
 | 
			
		||||
                LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
 | 
			
		||||
                trumpet = true;
 | 
			
		||||
                trumpet = 2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Right Wall Check
 | 
			
		||||
@@ -159,12 +162,15 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
            _isJumpCut = false;
 | 
			
		||||
            _isJumpFalling = false;
 | 
			
		||||
            Jump();
 | 
			
		||||
            if (!IsGrounded() && in_range && trumpet) {
 | 
			
		||||
            if (!IsGrounded() && in_range && trumpet > 0)
 | 
			
		||||
            {
 | 
			
		||||
                Destroy(enemy.gameObject);
 | 
			
		||||
                enemy = null;
 | 
			
		||||
                in_range = false;
 | 
			
		||||
            } else if (!IsGrounded() && !in_range && trumpet) {
 | 
			
		||||
                trumpet = false;
 | 
			
		||||
            }
 | 
			
		||||
            else if (!IsGrounded() && !in_range && trumpet > 0)
 | 
			
		||||
            {
 | 
			
		||||
                trumpet -= 1;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //WALL JUMP
 | 
			
		||||
@@ -395,7 +401,8 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    private bool CanJump()
 | 
			
		||||
    {
 | 
			
		||||
        if (!IsGrounded() && trumpet) {
 | 
			
		||||
        if (!IsGrounded() && trumpet > 0)
 | 
			
		||||
        {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        return LastOnGroundTime > 0 && !IsJumping;
 | 
			
		||||
@@ -425,7 +432,8 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
            return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public bool IsGrounded() {
 | 
			
		||||
    public bool IsGrounded()
 | 
			
		||||
    {
 | 
			
		||||
        // print(Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
 | 
			
		||||
        return (Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user