Background is not appeared as expected

Hi I’m new here, I need your help for the problem below:

I write the following code:


– most commonly used screen coordinates
centerX = display.contentCenterX
centerY = display.contentCenterY
screenLeft = display.screenOriginX
screenWidth = display.contentWidth - screenLeft * 2
screenRight = screenLeft + screenWidth
screenTop = display.screenOriginY
screenHeight = display.contentHeight - screenTop * 2
screenBottom = screenTop + screenHeight
display.contentWidth = screenWidth
display.contentHeight = screenHeight
– create backgroung
local sky = display.newRect(screenLeft,screenTop,screenWidth,screenHeight )


My expected result is to have it in full screen, but I got it in the different result(see attached image).

I don’t know what I missed, please help.

thanks
 

Hi @i-rithy,

Welcome to Corona! My first recommendation is that you read and fully understand the concept of “content area” in Corona, since it is a core and essential aspect of development within the SDK. You may have already learned some things about it, but if you haven’t read the following guide and watched the following video, please do so first:

https://docs.coronalabs.com/guide/basics/configSettings/index.html

http://youtu.be/RwVlzJtQWd8

Brent

i would try 

local sky = display.newImageRect(sky, "BackGround.png", 1080, 1920)

or

 local background = display.newImageRect("background.png",1080,1920) background.anchorX = 0.7 background.anchorY = 0.8 background.x = display.contentCenterX background.y = display.contentHeight

and just change the AnchorX and Y to your liking

 ive included a file image

Hi @i-rithy,

Welcome to Corona! My first recommendation is that you read and fully understand the concept of “content area” in Corona, since it is a core and essential aspect of development within the SDK. You may have already learned some things about it, but if you haven’t read the following guide and watched the following video, please do so first:

https://docs.coronalabs.com/guide/basics/configSettings/index.html

http://youtu.be/RwVlzJtQWd8

Brent

i would try 

local sky = display.newImageRect(sky, "BackGround.png", 1080, 1920)

or

 local background = display.newImageRect("background.png",1080,1920) background.anchorX = 0.7 background.anchorY = 0.8 background.x = display.contentCenterX background.y = display.contentHeight

and just change the AnchorX and Y to your liking

 ive included a file image