Log In  

Cart #grossgame-0 | 2021-09-28 | Code ▽ | Embed ▽ | No License

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?

P#97922 2021-09-28 11:33

this looks like it's where the jump happens. -6 is definitely not slow.

if btn(🅾️) and ground then
    jmp-=6
    ground=false
end
P#97930 2021-09-28 17:16 ( Edited 2021-09-28 17:16)
:: jmsnsh

ah that's the jump height, need to find a way to attach a speed to it

P#97932 2021-09-28 19:45

Get rid of this line:

jmp=flr(jmp)

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.

P#97933 2021-09-28 19:48

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-07-03 11:56:23 | 0.008s | Q:18