Jumping Issue with Physics <SOLVED>

At random times (about 1 in 20 clicks or so) my guy will jump far higher than he should. About 10 times higher! I've played with the physics for all of my objects and even the guy himself. It is the same result on all objects with different physical bodies. There is no output in the terminal. I've also tried using transition.to for jumping, but it doesn't give the results I need. I'm out of ideas on how to fix this. Any help as to why this could happen would help a lot. I'm slowly going crazy

* I found that without a "onPress" and "onRelease" for the button if forced a huge jump for some reason upon contact with the ground. I don't know how else to explain it, but this fixed it. Thanks for everyones help.

Perhaps if you provide some plug and play code someone might be able to take a look for you.

Skimming your code nothing stands out to me - at first I thought you might be using applyForce (which stacks) but as you aren't, it's really something I'd (and I'm sure others) would prefer to test.

Also, if you wouldn't mind posting your code in < lua > tags that would be a big help - much easier to read ;)

Peach :)

Okay, I changed it to Lua syntax. Thanks for the reply. My game is pretty much finished other than this one problem holding me back.

Bump. Sorry, I really need some ideas on this.

I don't know if this is the problem but I see in the jumpButton function there is no check for wether guy.canJump is true or false.

1
2
3
4
5
6
7
8
9
local jumpButton = function(event)
        if guy.canJump == true then --I have added the boolean check
                guy:applyLinearImpulse(0, -10, guy.x, guy.y)
        
                guy.state = STATE_JUMPING
 
 
        end
end
views:1256 update:2011/11/26 9:01:35
corona forums © 2003-2011