I've been working on building a simple and efficient platformer engine, and while it basically works, the character sprite can appear jittery depending on the character and camera movement, and I haven't figured out why. I've uploaded a prototype it you'd like to check it out. If anyone has some ideas or suggestions, I'd appreciate it, thanks.
I've also encountered a problem with the sprites being jittery positioned in relation to scrolling.
The following fix seems to fix the problem.
-- if px-camx>=60 or (px-camx<=48 and camx>0) then -- camx+=pdx -- end camx=px-mid(px-camx,60,48)
I don't know if it's an internal API problem, but at least when dealing with decimal numbers,
I think it's easy to round values or cause jitters in the calculation process.
Here now the solution would be simple, @JadeLombax. Use a soft-camera scroller. That is adjust your scrolling to recognize when it is starting to jitter and move the camera smoother than the player actually is traveling until both match.
Thanks for the code snippet. It didn't fully fix the issue, but it did save me about 10 tokens.=)
I did some experimenting, and replacing use of the camera() function with just putting the camera offset value into the map() function seemed to do the trick. Not sure why, maybe the camera() function is doing some extra math that can introduce errors. Anyway, here's the fixed cart. There are still a couple little issues to work out in the collision, but no more jitter!
This is interesting, I'll keep this in mind for my next project.
[Please log in to post a comment]