Absolute positioning V.s Percentage positioning

Hi Guys,

Very (very) new to this but we have an app that works fine for the Iphone which we are trying to get ported over for android. one issue we have is the various screen sizes.
is there a way to position an image via percentage of screen rather than static actual locations?

Thanks chaps.

Ian
[import]uid: 42102 topic_id: 7861 reply_id: 307861[/import]

I should also point out that I am trying to go smaller than the base 320 x 480 screen size rather than upscaling.
[import]uid: 42102 topic_id: 7861 reply_id: 27963[/import]

I am new to Corona as well so I am not sure if there is a better way but in my projects I position images by screen percentage rather than an absolute coordinate in pixels. An example would be:

-- Cache device screen height and width for use throughout  
-- your code to position display objects  
local height = display.contentHeight  
local width = display.contentWidth  
-- Create image to be displayed  
local image = display.newImage("image.png")  
-- To place an image in the center of the screen just  
-- multiply the height and width by 0.5 (which is 50%)  
image.x = width\*0.5  
image.y = height\*0.5  

By positioning in this way objects will always be displayed “relative” to screen size and resolution. It might not be the best way to scale a game designed for a small phone screen to a tablet, with a much larger screen, because it might compromise playability, but it works great for different resolutions on similar sized screens.
Hope that helps! [import]uid: 27965 topic_id: 7861 reply_id: 28245[/import]