- Home /
2D Double Jump problem
Hi guys,
I have made a 2D game from the character motor in the Unity sample assets. It's been expanded with a double jump function, so the character can jump again if doubleJump is false.
I have platforms in 3 layers.
It works as intended until i jump and hit a platform above me - then it's like it sets doubleJump = true, but i have no idea why.
The platforms i spawn has Layer: Ground.
Can anyone please help me see what the problem is? :)
PlatformerCharacter2D: http://pastebin.com/vP350N3J
Platformer2DUserControl: http://pastebin.com/PPnS8qRg
Thanks
Answer by jqp122 · Feb 24, 2014 at 08:24 PM
see if you can adapt the solution given in this video: http://www.youtube.com/watch?v=pF5KSTBPy4Y at around 4 minutes to your problem. I'm really new here so sorry if it doesn't help, but good luck!
the problem seems to be that any collision in any direction with ground sets the double jump boolean back to true, so you should have a groundcheck that only checks in the direction you want it to.