Problem with config.lua

Hi, everyone. I am making a pong game and I am having some trouble with the second pong I am making. I want the game to be responsive to different devices so I gave the second pong an anchorX of 1, and tried placing it at the right edge using display.actualContentWidth. But, it is placed off screen. Why is this happening? The only reason I can think of is something with config.lua:

application = { content = { width = 800, height = 1200, scale = "letterBox", fps = 30, --[[imageSuffix = { ["@2x"] = 2, ["@4x"] = 4, }, --]] }, }

Or is it possible that have to use contentWidth instead of actualContentWidth?

It worked when I used contentWidth and Height instead of actualContentWidth and Height. But, I am confused on the difference between these two.

It should be letterbox not letterBox Check out documentation.

Also, ‘display.actualContentWidth’ is not the right edge of the screen it is the actual width of the screen.

I know this is a bit counter-intuitive, but it becomes more clear the longer you deal with it.

The right edge is:

local right = display.contentCenterX + display.actualContentWidth/2

Don’t forget, as an SSK2 user, these helper global variables are exposed for your convenience:

  • right, left, top, bottom
  • centerX, centerY
  • w, h
  • fullw, fullh
  • … and others

So for you, it is as easy as this to make a green ball on the right edge of the screen:

local ball = ssk.display.newCircle( nil, right, centerY, { radius = 20, anchorX = 1, fill = \_G\_ } ) -- OR with a basic physics body: local ball = ssk.display.newCircle( nil, right, centerY, { radius = 20, anchorX = 1, fill = \_G\_ }, {} )

Whoops, I forgot about the globals in SSK2.

Or is it possible that have to use contentWidth instead of actualContentWidth?

It worked when I used contentWidth and Height instead of actualContentWidth and Height. But, I am confused on the difference between these two.

It should be letterbox not letterBox Check out documentation.

Also, ‘display.actualContentWidth’ is not the right edge of the screen it is the actual width of the screen.

I know this is a bit counter-intuitive, but it becomes more clear the longer you deal with it.

The right edge is:

local right = display.contentCenterX + display.actualContentWidth/2

Don’t forget, as an SSK2 user, these helper global variables are exposed for your convenience:

  • right, left, top, bottom
  • centerX, centerY
  • w, h
  • fullw, fullh
  • … and others

So for you, it is as easy as this to make a green ball on the right edge of the screen:

local ball = ssk.display.newCircle( nil, right, centerY, { radius = 20, anchorX = 1, fill = \_G\_ } ) -- OR with a basic physics body: local ball = ssk.display.newCircle( nil, right, centerY, { radius = 20, anchorX = 1, fill = \_G\_ }, {} )

Whoops, I forgot about the globals in SSK2.