I'm sort of at a loss right now on trying to get my snake to not be so wiggly when it's drawn. You can see the red head of the snake is fine...and nice clean draw no matter which way it's heading.
Press Z to add a segment and you'll see that each following segment is very wiggly when its draw, not clean at all...and I don't know why.
I don't know if it's just the way it's gonna be or if I'm drawing things wrong or just doing my calculations wrong for where segments are positioned. Or a little bit of everything wrong.
Any help, insight or suggestions are appreciated.
I'd guess it stems from the fact that it's both running at 60FPS and that everything is moving and being drawn at coordinates with several decimal places.
Making the camera stay still is probably reducing it because it keeps at least that aligned to the pixel grid, instead of making everything offset.
It won't be a perfect fix but you could try flooring all coordinates when drawing things to maybe reduce some of it (diagonal motion is still gonna be rough, though). I don't know any super consistent solution, though, unfortunately.
Perhaps you could make them only update every other frame/step?
dunno if you still need to know, but presumably, the offset that is passed to camera() is stored as an integer, that is, it's rounded, which messes things up. This quick hack disables camera() and applies the same offset manually:
camera() --pset(o.x,o.y,6) -- shows path pset(o.x-hx+64,o.y-hy+64,6) camera(hx-64,hy-64)
and the line becomes smooth. Same would go for the circles and whatever.
[Please log in to post a comment]