Code: Select all
function angle(x1, y1, x2, y2)
return math.atan2(y2-y1, x2-x1)
end
So to make it simple, how do I translate mouse coordinates?
What I tried to do was adding the offset that I don't really know where they came from (I just got it from printing my player.x and y and mouse.x and y and looking at the difference) and before putting mouse.x and mouse.y into the new player.angle player.x movement and player.y movement was added to the mouse.x and mouse.y and I thought that would update the mouse.x and mouse.y though still my mouse.x and mouse.y is boxed.
I have attached the code.