How you access the coordinates of an object and the object that belongs to a group?
What?
Can you show some code or something? I’m not understanding the question.
Do you mean this:
local myGroup = display.newGroup() display.newCircle( myGroup, 100, 100, 10 ) display.newCircle( myGroup, 110, 110, 10 ) display.newCircle( myGroup, 120, 120, 10 ) myGroup.x = myGroup.x + 100 myGroup.y = myGroup.y + 100 for i = 1, myGroup.numChildren do local obj = myGroup[i] print( i, obj.x, obj.y, myGroup.x, myGroup.y ) end
The above code will print:
1 100 100 100 100
2 110 110 100 100
3 120 120 100 100
Thank You. I will try to adapt it to my project. It will be helpful. Merry Christmas. A hug.
What?
Can you show some code or something? I’m not understanding the question.
Do you mean this:
local myGroup = display.newGroup() display.newCircle( myGroup, 100, 100, 10 ) display.newCircle( myGroup, 110, 110, 10 ) display.newCircle( myGroup, 120, 120, 10 ) myGroup.x = myGroup.x + 100 myGroup.y = myGroup.y + 100 for i = 1, myGroup.numChildren do local obj = myGroup[i] print( i, obj.x, obj.y, myGroup.x, myGroup.y ) end
The above code will print:
1 100 100 100 100
2 110 110 100 100
3 120 120 100 100
Thank You. I will try to adapt it to my project. It will be helpful. Merry Christmas. A hug.