Quantcast
Channel: Latest Questions by gallerdude200
Viewing all articles
Browse latest Browse all 8

Variable jumping doesn't work on second jump.

$
0
0
I have a project where the character can double jump. Today, I started adding code so variable jumping (the longer you hold down the up button, the higher he jumps) would work, and it works great, except for the fact that it doesn't work at all on the second jump of the double jump. Here's my code: function jump() { if (unlockables.doubleJumpUnlocked == false) { } if (unlockables.doubleJumpUnlocked == true) { if ((jumpOverride == false) && (jumps ().AddForce(Vector2.up * jumpHeight); jumping = true; groundCheck.grounded = false; jumps += 1; jumpCount = 0; Debug.Log("something else"); } if ((Input.GetKey("up")) && (jumpCount ().AddForce(Vector2.up * 15); jumpCount += 1; Debug.Log("did something" + jumpCount); } } } } A bit of background on the variables, if it helps: - "jumping" checks if I'm jumping - "jumps" counts the amount of jumps - "jumpCount" counts the amount of mini jumps inside the jumps that make up the variable jumping. - "jumpOverride" is a manual override to stop jumps, but i don't think that matters here. Thank you so much for your time, and I'm sorry for the messy code. It's probably some logic error I'm not seeing, but I've been messing this for 45 minutes, without any progress.

Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images