Group returns 0 for x and y positions

In page 1.lua, we have groups and tables defined as such:

image = {}

pageGroup = display.newGroup()

gp = {}

gp.mNav = display.newGroup( )
gp.fc = display.newGroup( )
gp.back = display.newGroup( )
 

We are passing this data into a module called pList like so:

pList.drawScreen1({image = image, imageData = imageData.nav, pageGroup = pageGroup, gp = gp })

Here is a look at the kind of info that is in table imageData.nav that is being passed into pList.drawScreen
 

{ group="mNav", gen="imageRect", rgb=nil, alpha = 0.5, name="bmshad", imgFile="mn\_bmshad", w=190, h=1194, x=1927, y=450-mNavY }, { gen="imageRect", rgb=nil, event=true, alpha=0.4, name="btn\_mNav", imgFile="mn\_bm", w=182, h=1190, x=1927, y=446-mNavY }, { gen="imageRect", rgb=nil, name="hem", imgFile="mn\_hem", w=162, h=1165, x=1927, y=435-mNavY } 

Within pList.drawScreen, a function iterates through imageData.nav to turn them into display.newImageRect, circles, sprites etc into the passed in image table.

Then each image is inserted into groups with provided names in the gp table e.g. group=“mNav”

After being put together in the module, they can be accessed in page 1 where the groups were created.

The only problem is, groups always return with their x and y positions as 0. We can access the groups, move them etc but they always return as position 0.

Just wondering if there’s anything that can be done to return the position of the group according to its children which you normally get when you place images into a group in its own scene.

Hi @kilopop,

I’m not following… groups always have an x and y of 0,0 unless you change that. Adding children to a group doesn’t affect this, just as if painting things on a canvas wouldn’t change the position of the canvas on the painter’s easel. Can you explain more what you’re trying to gather here?

Thanks,

Brent

Hey Brent, thanks for your reply. Yes groups were being positioned in the module. We traced the issue to child groups not being inside the parent group that was being positioned so those groups child groups kept returning zero. As you were :slight_smile:

Hi @kilopop,

I’m not following… groups always have an x and y of 0,0 unless you change that. Adding children to a group doesn’t affect this, just as if painting things on a canvas wouldn’t change the position of the canvas on the painter’s easel. Can you explain more what you’re trying to gather here?

Thanks,

Brent

Hey Brent, thanks for your reply. Yes groups were being positioned in the module. We traced the issue to child groups not being inside the parent group that was being positioned so those groups child groups kept returning zero. As you were :slight_smile: