How to fix coordinate offset

File main.lua

display.setStatusBar(display.HiddenStatusBar) local composer = require( "composer" ) display.setStatusBar(display.HiddenStatusBar) display.setDefault( "anchorX", 0 ) display.setDefault( "anchorY", 0 ) display.setDefault( "isAnchorClamped", true ) composer.gotoScene( "maps" )

File maps.lua

local composer = require ( "composer" )

local scene = composer.newScene()

local ID = system.getInfo( “deviceID” )

function scene:create( event )

    local sceneGroup = self.view

– Начало сцены Maps.lua

– 

local background = display.newImage( “maps.png” )

sceneGroup:insert ( background )

– Конец сцены Maps.lua

– 

end

scene:addEventListener( “create”,  scene )

return scene

When loading, the area remains at the top and the coordinates are shifted by 42 units.

How to fix this defect?

That is not a defect.  You need to understand how scaling works on different devices. <0,0> is not necessarily the top-left for all devices.

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

  1. Red that guide first.

2.  See this example where I show how to calculate the edges of the screen and full width and height regardless of the device.  Also, look at the basic config.lua that comes with the project:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/10/lgg4.zip

lgg4.png

Большое спасибо. 

Thank you very much.

Some other important additional reading on the subject: https://coronalabs.com/blog/2018/08/08/understanding-content-scaling-in-corona/

Rob

That is not a defect.  You need to understand how scaling works on different devices. <0,0> is not necessarily the top-left for all devices.

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

  1. Red that guide first.

2.  See this example where I show how to calculate the edges of the screen and full width and height regardless of the device.  Also, look at the basic config.lua that comes with the project:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/10/lgg4.zip

lgg4.png

Большое спасибо. 

Thank you very much.

Some other important additional reading on the subject: https://coronalabs.com/blog/2018/08/08/understanding-content-scaling-in-corona/

Rob