hey! trying to edit/change my code so that the jump is slower and smoother, does anyone know what i should add to this code to make that happen?
Get rid of this line:
You're not going to get a slow jump using only integer values. If you really need to make sure jmp is not a messy float, you would need to use shifting of some sort.
Next, you need less gravity. This means both changing g and also changing how much jmp is changed each frame. I'm not sure why your code handles jmp that way, as it means upward movement is disconnected from downward movement, but whatever. After fiddling, I found that setting g=.5 and changing jmp by only .1 seems to work for the bits of level you already have. That would mean code that looks like this:
if jmp<0 then jmp+=.1 elseif jmp>0 then jmp-=.1 end
That should get you a slow jump that goes at the same height as you currently have the jump going to, with just enough time to cross the 2 sprite long spike pits.
[Please log in to post a comment]