Log In  

Cart #yipipanumu-0 | 2019-03-27 | Code ▽ | Embed ▽ | No License

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.

P#63074 2019-03-27 21:59 ( Edited 2019-03-27 22:00)

I think my issue might have something to do with using camera()...? Hmmm.

If I turn off camera, both the snake and the background are less wobbly.

Sadly, I need the camera on...hrrmmmm

P#63080 2019-03-28 00:44

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?

P#63082 2019-03-28 02:03 ( Edited 2019-03-28 02:05)

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:

--pset(o.x,o.y,6) -- shows path

and the line becomes smooth. Same would go for the circles and whatever.

P#64522 2019-05-17 21:27 ( Edited 2019-05-17 21:28)

[Please log in to post a comment]