moved trumpet jump to new player controller
this should work, though i'm still not 100% sure how the new jump works
This commit is contained in:
		@@ -101,7 +101,7 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
        if (!IsJumping)
 | 
			
		||||
        {
 | 
			
		||||
            //Ground Check
 | 
			
		||||
            if (Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping) //checks if set box overlaps with ground
 | 
			
		||||
            if (IsGrounded()) //checks if set box overlaps with ground
 | 
			
		||||
            {
 | 
			
		||||
                LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
 | 
			
		||||
                trumpet = true;
 | 
			
		||||
@@ -151,6 +151,13 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
            _isJumpCut = false;
 | 
			
		||||
            _isJumpFalling = false;
 | 
			
		||||
            Jump();
 | 
			
		||||
            if (!IsGrounded() && in_range && trumpet) {
 | 
			
		||||
                Destroy(enemy.gameObject);
 | 
			
		||||
                enemy = null;
 | 
			
		||||
                in_range = false;
 | 
			
		||||
            } else if (!IsGrounded() && !in_range && trumpet) {
 | 
			
		||||
                trumpet = false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        //WALL JUMP
 | 
			
		||||
        // else if (CanWallJump() && LastPressedJumpTime > 0)
 | 
			
		||||
@@ -210,6 +217,7 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void FixedUpdate()
 | 
			
		||||
    {
 | 
			
		||||
@@ -380,6 +388,9 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    private bool CanJump()
 | 
			
		||||
    {
 | 
			
		||||
        if (!IsGrounded() && trumpet) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        return LastOnGroundTime > 0 && !IsJumping;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -406,6 +417,10 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
        else
 | 
			
		||||
            return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public bool IsGrounded() {
 | 
			
		||||
        return (Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
 | 
			
		||||
    }
 | 
			
		||||
    #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user