Hello, I'm making a 2d game with a camera that can zoom in and out. I use the following function to get the screen coordinates of a position based on the camera's position and level of zoom.
function getScreenLocationX( x )
x = ( x*camera.zoom ) + camera.x
endfunction x
But I can't figure out a way to find the actual world position based on given screen coordinates, I assumed I would just reverse the function, but it didn't have the expected results.
Is anybody good with maths that could help? :p
Also, the zoom function doesn't zoom towards the centre of the screen, it zooms towards the corner, can anybody tell me how to make it zoom in the centre?
Thanks