Working out resolution independent values from regular pixel specific values

I’m trying to retrieve data which will tell me the position of an object after i have moved it on the screen. I have managed to get specific pixel coordinates however I can’t seem to figure how i can retrieve the value of the coordinates in a resolution independent way.

To be clear I would like to print the coordinates which will tell me the values in a way that is shown below instead of the regular pixel specific way

1
2
image.x = _W * 0.68; 
image.y =_H * 0.4

You could take the pixel coordinates and divide them by the height or width of the screen such as:

1
2
3
4
local imageX = _W/image.x
local imageY = _H/image.y
 
print(imageX, imageY)

Thanks just figured it out myself and was about to reply. Obvious really!

views:1388 update:2011/9/30 9:15:39
corona forums © 2003-2011