anchorChildren Bug?

I’m working on my new game, and I’m setting a group’s anchorChildren property to true.

When I do so, it shifts every circle slightly to the left. Here’s my code:

local function displayCircles(ui, radius, number) local group = display.newGroup() ui:insert(group) local cos, sin, pi = math.cos, math.sin, math.pi local colors = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {1, 1, 1}, {0, 0, 0}} local offset = number / 2 math.randomseed(1) for i = 0, number - 1 do local angle = i \* pi / offset local circle = display.newImage(group, "visuals/game/circle.png") circle.x, circle.y = radius \* cos(angle), radius \* sin(angle) local color = colors[math.random(1, 5)] circle:setFillColor(color[1], color[2], color[3]) end --group.anchorChildren = true group.offset = offset group:addEventListener("touch", onTouch) return group end

If I uncomment line 15, the circles display how they should.

Here is a gif comparing the two results: http://gifmaker.me/PlayGIFAnimation.php?folder=2014030214fy7FnVT4uTg8t2LNrdpixS&file=output_gV6LY7.gif

From what I can tell, this may be a bug. Then again, I could just be misusing the anchorChildren property.

That’s not a bug it’s by design. Setting anchorChildren to true will snap the contents to groups 0, 0 position.

If you have your left most objects left most pixel at 5 and anchorX on the group is 0 it will move the content by 5 pixels to the left.

See this guide:

https://docs.coronalabs.com/guide/graphics/group.html

That’s not a bug it’s by design. Setting anchorChildren to true will snap the contents to groups 0, 0 position.

If you have your left most objects left most pixel at 5 and anchorX on the group is 0 it will move the content by 5 pixels to the left.

See this guide:

https://docs.coronalabs.com/guide/graphics/group.html