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. [import]uid: 46082 topic_id: 18121 reply_id: 318121[/import]

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 :wink:

Peach :slight_smile: [import]uid: 52491 topic_id: 18121 reply_id: 69298[/import]

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. [import]uid: 46082 topic_id: 18121 reply_id: 69303[/import]

Bump. Sorry, I really need some ideas on this. [import]uid: 46082 topic_id: 18121 reply_id: 69365[/import]

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.
[lua]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[/lua] [import]uid: 27965 topic_id: 18121 reply_id: 69371[/import]