Does "delta = false" in a transition work over a Display Group?

Hi,

I was working on a zoom in function over a special part in my game. This part is a display group and I want it to zoom in and set the positions to the middle of the screen but I seem to have some problems.

If you look at this code:

local bool = false local x = display.contentWidth \* 0.5 local y = display.contentHeight \* 0.5 local rect0 = display.newRect( 50, 50, 50, 50) transition.to(rect0, { x = 200, y = y, delta = bool}) local rect1 = display.newRect( 50, 110, 50, 50) transition.to(rect1, { x = 200, y = y, delta = bool}) local rect2 = display.newRect( 50, 170, 50, 50) local rect3 = display.newRect( 50, 230, 50, 50) local dg = display.newGroup() dg:insert( rect2 ) dg:insert( rect3 ) transition.to(dg, { x = 200, y = y, delta = bool}) print(dg.height, dg.width)

The expected value is the the two “loose” rectangles goes to the set position (which they do) and that the dg also go to that position.

Is this a bug or doesn’t delta work on a display group or am I missing something?

Best regards,

Tomas

Can someone comment on this?

Best regards,

Tomas

delta = false would mean that the values provided to the transition are absolute parameters.  So the origin of the display group (which defaults to 0, 0) will end up at x = 200, y = display.contentHeight * 0.5.  If delta is true, in this case, it will still end up at x = 200 and y = display.contentHeight * 0.5 since delta means to add the right hand side of the existing value of x and y.  Since the x and y start at 0, it works out the same.

Rob

Basically I have two display groups that I want when being touched to go into the middle (let’s say display.contentWidht * 0.5 and display.contentHeight * 0.5). One is in the upper left corner and the other is in the bottom left corner.

It doesn’t matter what I change the delta to in this statement, both the display groups go straight down:

Does not work as expected! Works as if delta was set to true.

local x = display.contentWidth \* 0.5 local y = display.contentHeight \* 0.5 local rect2 = display.newRect( 50, 0, 50, 50) local rect3 = display.newRect( 50, 0, 50, 50) local dg = display.newGroup() dg:insert( rect2 ) dg:insert( rect3 ) transition.to(dg, { x = 200, y = y, delta = false}) local dg2 = display.newGroup() local rect3 = display.newRect( 50, 250, 50, 50) local rect4 = display.newRect( 50, 250, 50, 50) local dg2 = display.newGroup() dg2:insert( rect3 ) dg2:insert( rect4 ) transition.to(dg2, { x = 200, y = y, delta = false})

However if I’m not using a display group the two rectangels meet at the absolute parameter:

Works as expected!

local x = display.contentWidth \* 0.5 local y = display.contentHeight \* 0.5 local rect1 = display.newRect( 50, 0, 50, 50) local rect2 = display.newRect( 50, 250, 50, 50) transition.to(rect1, { x = 200, y = y, delta = false}) transition.to(rect2, { x = 200, y = y, delta = false})

Ok, I do understand the reasoning you are saying, that the display groups origin start at 0,0 but shouldn’t they inherit the x and y from it’s objects?

Best regards,

Tomas

No, the group has it’s own x, and y.  Moving the group moves it’s children relative to it.

Rob

Can someone comment on this?

Best regards,

Tomas

delta = false would mean that the values provided to the transition are absolute parameters.  So the origin of the display group (which defaults to 0, 0) will end up at x = 200, y = display.contentHeight * 0.5.  If delta is true, in this case, it will still end up at x = 200 and y = display.contentHeight * 0.5 since delta means to add the right hand side of the existing value of x and y.  Since the x and y start at 0, it works out the same.

Rob

Basically I have two display groups that I want when being touched to go into the middle (let’s say display.contentWidht * 0.5 and display.contentHeight * 0.5). One is in the upper left corner and the other is in the bottom left corner.

It doesn’t matter what I change the delta to in this statement, both the display groups go straight down:

Does not work as expected! Works as if delta was set to true.

local x = display.contentWidth \* 0.5 local y = display.contentHeight \* 0.5 local rect2 = display.newRect( 50, 0, 50, 50) local rect3 = display.newRect( 50, 0, 50, 50) local dg = display.newGroup() dg:insert( rect2 ) dg:insert( rect3 ) transition.to(dg, { x = 200, y = y, delta = false}) local dg2 = display.newGroup() local rect3 = display.newRect( 50, 250, 50, 50) local rect4 = display.newRect( 50, 250, 50, 50) local dg2 = display.newGroup() dg2:insert( rect3 ) dg2:insert( rect4 ) transition.to(dg2, { x = 200, y = y, delta = false})

However if I’m not using a display group the two rectangels meet at the absolute parameter:

Works as expected!

local x = display.contentWidth \* 0.5 local y = display.contentHeight \* 0.5 local rect1 = display.newRect( 50, 0, 50, 50) local rect2 = display.newRect( 50, 250, 50, 50) transition.to(rect1, { x = 200, y = y, delta = false}) transition.to(rect2, { x = 200, y = y, delta = false})

Ok, I do understand the reasoning you are saying, that the display groups origin start at 0,0 but shouldn’t they inherit the x and y from it’s objects?

Best regards,

Tomas

No, the group has it’s own x, and y.  Moving the group moves it’s children relative to it.

Rob