I've been trying to make a picture follow the mouse pointer with LÖVE2D.
I want that the object follow the mouse, and not just be the mouse coordinates, I did that. So I toked the distance between the objects:
distance = dist(object.x, mouseX, object.y, mouseY)
the dist definition is the one from analytic geometry(Distance between two points in the Cartesian plan), well, now I don't know what to do, I tried a timer to update the object's coordinates but didn't work out.
if object.timer >= 2 then --object.x = mouseX --object.y = mouseY object.x = mouseX - distance object.y = mouseY - distance object.timer = 0 end
It didn't work out either :(. Well, I tried some other stuff, like whale.x - distance, but didn't worked out either, how can I make the object follow the mouse, like, if I let my mouse on (500, 300(Screen coordinates) the image would follow until it reaches the position desired which is the mouse position.
And yea, I really need to learn more math. >.>