Remove to the group a object in a group

I was wondering If I can remove an object in a group.

What I want to do is to transfer an object from one group to another

its like this:

g1 = display.newGroup() g2 = display.newGroup() object = display.newRect(centerX,centerY,100,100) g1:insert(object) --remove object from g1 and transfer it to g2 g2:insert(object)

in this way, whatever I do to g1 whether change its X and Y or its scale, the  object will not be affected

thanks in advance

A display object can not reside in two groups at once. If an object is in a group, simply insert it into a new group. This removes it from the first. 

local objectGroup1 = display.newGroup() -- create a group local objectGroup2 = display.newGroup() -- create another group -- create object, place it in objectGroup1 local object = display.newImageRect(objectGroup1, "someimage.png",100,100) -- some time later objectGroup2:insert(object) -- put object in second group, it is removed from first group

oh okay thanks :slight_smile:

A display object can not reside in two groups at once. If an object is in a group, simply insert it into a new group. This removes it from the first. 

local objectGroup1 = display.newGroup() -- create a group local objectGroup2 = display.newGroup() -- create another group -- create object, place it in objectGroup1 local object = display.newImageRect(objectGroup1, "someimage.png",100,100) -- some time later objectGroup2:insert(object) -- put object in second group, it is removed from first group

oh okay thanks :slight_smile: