image positioning

where does corona decide to put images that are supposed to be at 0,0? I have a 100 x 100 img

heres the code

local background = display.newRect(160, 240, 320, 568) background:setFillColor(1,1,1) local foo = display.newImageRect("images/foo.png", 100, 100); -- Local path to image, width, height foo.x, foo.y = 0, 0

my understanding was that it would put the middle of the image 50,50 at the x,y of 0,0 but this does not seem to be the case.

It is, but 0,0 on your screen is not at the top.  Why?  Probably because of you config.lua settings.

This is a semi-deep topic, but you have to understand it first before you can understand how your app/game will display on multiple different devices with different resolutions.

http://docs.coronalabs.com/daily/guide/basics/configSettings/index.html

Thanks roaminggamer, I changed the config.lua files to the config that Lerg made as mentioned to me by StarCrunch and my image positioning is now dead on in the middle at 0,0. This config file seems a little complicated to me as im new to coding but ill read up on it and hopefully that will help me understand it more. 

-Hendrix

@Hendrix,

Just be aware.  It is crucial to master this first or you’ll find yourself (possibly) facing lots of rework later when you’re assumptions about visible real-estate turn out wrong.

Also, you should go back through the blogs here and read all of the old and new articles on config.lua.  They should help you understand them better and see where we are with regards to technology and config.lua files.

-Ed

Oh, one more thing.  If you are really keen on doing game coding now and learning about scaling later, then you can always use ‘zoomStretch’ scaling.  It won’t look good in all cases, but it is dead simple.  

-Ed

display.newImageRect() does not take an X, Y as parameters.  It takes a Width and Height.   Therefore it draws the center of the image at 0, 0.  You need to set the .x and .y parameters on a separate line of code like you did before.

Rob

It is, but 0,0 on your screen is not at the top.  Why?  Probably because of you config.lua settings.

This is a semi-deep topic, but you have to understand it first before you can understand how your app/game will display on multiple different devices with different resolutions.

http://docs.coronalabs.com/daily/guide/basics/configSettings/index.html

Thanks roaminggamer, I changed the config.lua files to the config that Lerg made as mentioned to me by StarCrunch and my image positioning is now dead on in the middle at 0,0. This config file seems a little complicated to me as im new to coding but ill read up on it and hopefully that will help me understand it more. 

-Hendrix

@Hendrix,

Just be aware.  It is crucial to master this first or you’ll find yourself (possibly) facing lots of rework later when you’re assumptions about visible real-estate turn out wrong.

Also, you should go back through the blogs here and read all of the old and new articles on config.lua.  They should help you understand them better and see where we are with regards to technology and config.lua files.

-Ed

Oh, one more thing.  If you are really keen on doing game coding now and learning about scaling later, then you can always use ‘zoomStretch’ scaling.  It won’t look good in all cases, but it is dead simple.  

-Ed

display.newImageRect() does not take an X, Y as parameters.  It takes a Width and Height.   Therefore it draws the center of the image at 0, 0.  You need to set the .x and .y parameters on a separate line of code like you did before.

Rob