Fixed Jumping Again

main
thoopchuk26 4 years ago
parent aaf12fab2b
commit 7b647069fc

@ -36,6 +36,11 @@ public class movement : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (rb2d.velocity.y == 0)
{
isGrounded = true;
}
if (Input.GetKeyDown("space") && numJumps > 0) if (Input.GetKeyDown("space") && numJumps > 0)
{ {
rb2d.velocity = new Vector2(rb2d.velocity.x, 0); rb2d.velocity = new Vector2(rb2d.velocity.x, 0);
@ -125,12 +130,7 @@ public class movement : MonoBehaviour
private void OnCollisionEnter2D(Collision2D collision) private void OnCollisionEnter2D(Collision2D collision)
{ {
if(collision.gameObject.tag == "Floor")
{
numJumps = maxJumps;
isGrounded = true;
Debug.Log("Able to Jump");
}
} }
private void JumpAnimation() private void JumpAnimation()

Loading…
Cancel
Save