How do you achieve smooth character movement?
Normally, you'd take a speed value and multiply it by a delta time value so your character moves the same speed regardless of the clock speed. Pico-8 is frame limited to 30 FPS, but it still seems like my character jumps and hops by small amounts if I press and hold a button down.
Is it the right way to put: if btn(0, 0) x += 1.3 (or whatever) in the _update() and then spr(1, x, y) in the _draw()?
Yes, I think that should work.
Does, for example, idle doodle isle scroll smoothly for you? https://www.lexaloffle.com/bbs/?tid=1946&pid=10548
While you can change the coordinates as you please, keep in mind that pico-8 will always draw graphics on rounded coordinates, meaning that moving it in steps of 1.3 will appear as if it's moving 2px once per every ~3 frames and for 1px at other times.
I wouldn't worry about always using full integers. You still get a a lot of varied movement speeds using floats, its just that the movement isn't as silky smooth as it could be.
If there was a deltaTime variable when calling _draw you could smooth it out nicer assuming there is still some variation when the _draw is called even when frame limited. I'll do some tests using Time() if it has enough precision.
I think the low resolution of the output is the main culprit.
[Please log in to post a comment]