diff --git a/Assets/Scenes/WalljumpTest.unity b/Assets/Scenes/WalljumpTest.unity index 32210e0..6abbb04 100644 --- a/Assets/Scenes/WalljumpTest.unity +++ b/Assets/Scenes/WalljumpTest.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3068cfb020c63f83208257a320bd304d6ca9d242ccae224c067abb6952eedefa -size 275436 +oid sha256:7cad676d600bd9af5447b2280a2a11e71976aeb8ede54c16ee5489740f57eeae +size 276836 diff --git a/Assets/Scripts/Character/CharacterController2D.cs b/Assets/Scripts/Character/CharacterController2D.cs index aa86fc2..4a8b2a2 100644 --- a/Assets/Scripts/Character/CharacterController2D.cs +++ b/Assets/Scripts/Character/CharacterController2D.cs @@ -4,6 +4,7 @@ using UnityEngine.Events; public class CharacterController2D : MonoBehaviour { [SerializeField] private float m_JumpForce = 400f; // Amount of force added when the player jumps. + [SerializeField] private float m_WallJumpMultiplier = 3f; // Amount of force added when the player jumps off a wall. [Range(0, 1)] [SerializeField] private float m_CrouchSpeed = .36f; // Amount of maxSpeed applied to crouching movement. 1 = 100% [Range(0, .3f)] [SerializeField] private float m_MovementSmoothing = .05f; // How much to smooth out the movement [SerializeField] private bool m_AirControl = false; // Whether or not a player can steer while jumping; @@ -87,7 +88,6 @@ public class CharacterController2D : MonoBehaviour if (!crouch) { // If the character has a ceiling preventing them from standing up, keep them crouching - if (Physics2D.OverlapCircle(m_CeilingCheck.position, k_CeilingRadius, m_WhatIsGround)) { crouch = true; } @@ -158,13 +158,13 @@ public class CharacterController2D : MonoBehaviour { if (m_FacingRight && m_LastWallJumpDirection == Direction.L) { - m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce)); + m_Rigidbody2D.AddForce(new Vector2(m_JumpForce * m_WallJumpMultiplier * (m_FacingRight ? 1f : -1f), m_JumpForce * m_WallJumpMultiplier)); m_LastWallJumpDirection = Direction.R; } else if (!m_FacingRight && m_LastWallJumpDirection == Direction.R) { - m_Rigidbody2D.AddForce(new Vector2(0f, m_JumpForce)); + m_Rigidbody2D.AddForce(new Vector2(m_JumpForce * m_WallJumpMultiplier * (m_FacingRight ? 1f : -1f), m_JumpForce * m_WallJumpMultiplier)); m_LastWallJumpDirection = Direction.L; }