Why do you have to set the coordinates of group “circles” to -150, 150 to place that group in the opposite direction of group “squares”, while group “squares” was positioned using 50, -50?
[lua]display.setStatusBar(display.HiddenStatusBar)
– Mark screen origin
local screenOrigin = display.newCircle(0, 0, 4)
screenOrigin:setFillColor(128, 128, 128)
local screenOriginLabel = display.newText(“Screen Origin”, 10, 10, native.systemFont, 16)
screenOriginLabel:setTextColor(128, 128, 128)
– Create and position top group
local topGroup = display.newGroup()
topGroup.x = display.contentWidth / 2
topGroup.y = display.contentHeight / 2
– Mark top group origin
local topGroupOrigin = display.newCircle(topGroup.xOrigin, topGroup.yOrigin, 4)
topGroupOrigin:setFillColor(128, 128, 128)
local topGroupLabel = display.newText(“Top Group Origin”, 0, 0, native.systemFont, 16)
topGroupLabel:setTextColor(128, 128, 128)
topGroupLabel:setReferencePoint(display.CenterReferencePoint)
topGroupLabel.x = topGroup.xOrigin
topGroupLabel.y = topGroup.yOrigin + 10
– Create the “squares” group and position it at 50, -50 in relation to the origin of the top group
local squares = display.newGroup()
topGroup:insert(squares)
squares.x = 50
squares.y = -50
– Add 4 red squares to the “squares” group
local square1 = display.newRect(0, 0, 10, 10)
square1:setFillColor(255, 0, 0)
squares:insert(square1)
square1.x = 50
square1.y = -50
local square2 = display.newRect(0, 0, 10, 10)
square2:setFillColor(255, 0, 0)
squares:insert(square2)
square2.x = 75
square2.y = -50
local square3 = display.newRect(0, 0, 10, 10)
square3:setFillColor(255, 0, 0)
squares:insert(square3)
square3.x = 50
square3.y = -25
local square4 = display.newRect(0, 0, 10, 10)
square4:setFillColor(255, 0, 0)
squares:insert(square4)
square4.x = 75
square4.y = -25
– Create the “circles” group and position it at -50, 50 in relation to the origin of the top group
local circles = display.newGroup()
topGroup:insert(circles)
– WHY? Why doesn’t -50, 50 produce the expected result?
circles.x = -150
circles.y = 150
– Add 4 red circles to the “circles” group
local circle1 = display.newCircle(0, 0, 5)
circle1:setFillColor(0, 0, 255)
circles:insert(circle1)
circle1.x = 50
circle1.y = -50
local circle2 = display.newCircle(0, 0, 5)
circle2:setFillColor(0, 0, 255)
circles:insert(circle2)
circle2.x = 75
circle2.y = -50
local circle3 = display.newCircle(0, 0, 5)
circle3:setFillColor(0, 0, 255)
circles:insert(circle3)
circle3.x = 50
circle3.y = -25
local circle4 = display.newCircle(0, 0, 5)
circle4:setFillColor(0, 0, 255)
circles:insert(circle4)
circle4.x = 75
circle4.y = -25[/lua] [import]uid: 59054 topic_id: 10328 reply_id: 310328[/import]