I’ve built a game similar to Doodle Jump. My character jumps up through platforms and then jumps when he comes down on top of them.
I am experiencing some very strange behaviour with his jumps though. If the character is just jumping on the spot on the same platform then he always goes the same height. The issue occurs when the character jumps through the bottom of one platform and ontop of another, the character seems to jump far far higher than he should. This is making the game quite unplayable, as the rest of the game can’t keep up with it. The height is about double what it should be.
My code for the jump is:
local function onPlatformCollision( event )
vx, vy = man:getLinearVelocity()
if vy \> 0 then
man:setLinearVelocity( 0, 0 )
man:applyLinearImpulse(0, -0.6, man.x, man.y)
end
end
I thought I was stopping the man from moving with setLinearVelocity(), but I’m not sure this is working because I would have thought man:setLinearVelocity( 0, 0 ) would stop him moving horizontally aswell as vertically, but it doesn’t - the character just moves freely.
Am I missing something?
Any help appreciated as always
[import]uid: 61422 topic_id: 15444 reply_id: 315444[/import]