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?
Animation easing?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Animation easing?
Code: Select all
--update
px = px - dt*(distance_to_mouse/10)
-
- Prole
- Posts: 1
- Joined: Thu Nov 17, 2022 11:59 am
- Contact:
Re: Animation easing?
This may be a really difficult question, I am very curious about the answers that will be given.
Who is online
Users browsing this forum: No registered users and 8 guests