Animation easing?
Posted: Mon Nov 14, 2022 5:37 pm
just making a basic breakout type game and this is the code i have for it atm:
function love.load()
px = 500
end
function love.update(dt)
-- paddle movement
px = love.mouse.getX()
end
function love.draw()
-- draw upper left text
love.graphics.setColor(1, 1, 1)
love.graphics.print("by idoblenderstuffs", 0, 0)
love.graphics.print(tostring(love.timer.getFPS( )),0,20)
-- draw paddle
love.graphics.line(px+100, 500, px- 100, 500)
end
in other engines, ive been able to smoothly move the paddle by doing something like
px = px - (distance to mouse/10)
but in love, this does it WAY too fast so its basically instant.
i tried using bigger values like 100, and it almost fixes it, but for some reason moving left is a lot faster than moving right?? it makes it feel extremely jank to move the paddle about like that.
how would i make the paddle smoothly move towards the mouse X?
function love.load()
px = 500
end
function love.update(dt)
-- paddle movement
px = love.mouse.getX()
end
function love.draw()
-- draw upper left text
love.graphics.setColor(1, 1, 1)
love.graphics.print("by idoblenderstuffs", 0, 0)
love.graphics.print(tostring(love.timer.getFPS( )),0,20)
-- draw paddle
love.graphics.line(px+100, 500, px- 100, 500)
end
in other engines, ive been able to smoothly move the paddle by doing something like
px = px - (distance to mouse/10)
but in love, this does it WAY too fast so its basically instant.
i tried using bigger values like 100, and it almost fixes it, but for some reason moving left is a lot faster than moving right?? it makes it feel extremely jank to move the paddle about like that.
how would i make the paddle smoothly move towards the mouse X?