Hi guys,
Even though similar questions have been asked before, I still can’t get positioning of my objects properly on my screen across different devices and would appreciate some help.
I have two display groups full of objects and I want them centered vertically, without overlapping each other. This is the code I use:
local minVisibleX = display.screenOriginX local maxVisibleX = display.viewableContentWidth - display.screenOriginX local minVisibleY = display.screenOriginY local maxVisibleY = display.viewableContentHeight - display.screenOriginY local xMid = minVisibleX + (maxVisibleX - minVisibleX)\*0.5 local yMid = minVisibleY + (maxVisibleY - minVisibleY)\*0.5 .... mydemo.demoGroup:setReferencePoint(display.CenterReferencePoint) mhelper.menuGroup:setReferencePoint(display.CenterReferencePoint) mydemo.demoGroup.y = yMid - 0.5\*mydemo.demoGroup.height mhelper.menuGroup.y = yMid + 0.5\*mhelper.menuGroup.height
And I always get the top and bottom of the groups cut off, with a big chunk of empty space between them, instead of the demogroup’s bottom being up against the menugroup’s top.
thanks in advance to anyone helping me stop pulling out any more hair!
Z