Hi all!
I am working on a small pong clone:
https://www.lexaloffle.com/bbs/?tid=29815
I am unable to solve the paddle movement jerkiness.
It is working perfectly if I move 1px per time but, if I increase paddle speed, it becomes really...
Bad.
Any suggestions?
Thanks for your time and patience :)
Hello. This may be relevant to you.
Hi solar!
Thanks for your kind help :)
I've read it but I am a simpleton and my mind is now blown:
https://media.giphy.com/media/26ufdipQqU2lhNA4g/giphy.gif
What should I do?
As far as I've understood I should change the speed of the pads but I am unsure of the formula I should apply...
I'm thinking you can fix it by making sure you're moving by whole-pixel values per frame, and making sure that the paddles are positioned on screen with whole-pixel values as well. So basically you'd just be adding FLR() in a few places.
Hi, I've been struggling with a similar problem and I found that if you are moving an object less than 1 pixel you need to make sure that it's a power of two.
Hi guys!
While I was lurking like crazy on the forum I've found another priceless gem from ultrabrite and it works like a charm to solve my issue.
I cannot find the link again because I am a silly person but I've kept what he wrote.
What ultrabrite wrote:
--wrap around
if btn(0) then ship.x=(ship.x+127)%128 end
if btn(1) then ship.x=(ship.x+1)%128 end
-- more generally
ship.x=(ship.x+128+dx)%128
--walls
if btn(0) then ship.x=max(0,ship.x-1) end
if btn(1) then ship.x=min(ship.x+1,128) end
-- more generally
ship.x=mid(0,ship.x+dx,128)
[Please log in to post a comment]