StoryBoard Group within group?

Hi All,

So i am looking at trying to solve a problem - have lots of display objects in the app, and i do lots of transitions/translates

At present i individually translate/transition them.

My question is can i group up 5 call this group A and then insert into the main storyboard group

I tried groupA:insert( B )

and then group:insert( groupA) but that does not seem to work.

In the docs it states that an object cannot be in two groups

“Inserting display objects into a group, removes the object from it current group (objects cannot be in multiple groups). All display objects are part of current stage when first created. (At this time Corona only has one stage, which is the entire screen area. You could think of this as the “main stage” display group.)”

I’m just not sure if the situation is covered by the above rule - i’m not trying to insert object B into group - i am trying to insert GroupA (which contains object B into group.

 

Anybody come across a similar problem?

 

Would the situation of not trying to insert into storyboard group work - but then as a newbie i rely on storyboard for alot of cleanup? But then i would have to nil out all objects and remove right?

thanks

 

You should be able to put objects into an arbitrary group then put that group into the scene’s “group”.

Did you happen to find a solution for this? I am trying to do the exact same thing and for some reason can’t get it working with storyboard. 

I have a couple different groups and with Director Class I was able to just insert those groups into the “localGroup” and all was well.

That same approach is not working for me with Storyboard, however.

What do you mean “its not working” that’s a very vague error report.  Yes, with 100% certainty you can put GroupA into the storyboard group by doing:

function scene:createScene(event)

local group = scene.view

 

obj = display.newRect(0,0,10,10)

groupA = display.newGroup()

groupA:insert(obj)

group:insert(groupA)

end

This will also work in director.  You can put groups inside of localGroup.   When the docs say an object can’t be in two groups at once, it means like this:

local groupA = display.newGroup()

local groupB = display.newGroup()

local obj = display.newRect(0,0,10,10)

groupA:insert(obj)

groupB:insert(obj)

that example obj will end up in groupB.  It cannot be in two groups at the same time.  However what you are trying to do, the object is in groupA, and groupA (think of it as it’s own object) is what is in group

Looks like I got it working, was doing it slightly wrong seems like.

Here was the old code that worked with Director:

local roadGroup = display.newGroup() local sideGroup = display.newGroup() local enemyGroup = display.newGroup() local localGroup = display.newGroup(roadGroup, sideGroup, enemyGroup)  

So I thought I would be able to just add this one line to insert all these groups into the scene’s view group:

group:insert(localGroup)  

This was not working so I just tried inserting all the groups individually into “group” and deleted the “localGroup” all together, works now.

You should be able to put objects into an arbitrary group then put that group into the scene’s “group”.

Ok - i got the concept working on a small simple demo but on trying to incorporate into game am striking some bugs.

question -  I was inserting a circle image and then loading some text within the circle (grouping it)

My assumption was that the bigger object (Circle) was my main X, Y location - but i am thinking i may be wrong in this!

  • i used to use grouping in Powerpoint/excel a lot

When using groups is it like making a photoshop layer in which the area of the group is the entire display ( 320, 480 ) and if you add objects with X,Y just lock those objects at that position on that layer - then if you want to translate you move the whole layer?

Am i right?

T.

Did you happen to find a solution for this? I am trying to do the exact same thing and for some reason can’t get it working with storyboard. 

I have a couple different groups and with Director Class I was able to just insert those groups into the “localGroup” and all was well.

That same approach is not working for me with Storyboard, however.

What do you mean “its not working” that’s a very vague error report.  Yes, with 100% certainty you can put GroupA into the storyboard group by doing:

function scene:createScene(event)

local group = scene.view

 

obj = display.newRect(0,0,10,10)

groupA = display.newGroup()

groupA:insert(obj)

group:insert(groupA)

end

This will also work in director.  You can put groups inside of localGroup.   When the docs say an object can’t be in two groups at once, it means like this:

local groupA = display.newGroup()

local groupB = display.newGroup()

local obj = display.newRect(0,0,10,10)

groupA:insert(obj)

groupB:insert(obj)

that example obj will end up in groupB.  It cannot be in two groups at the same time.  However what you are trying to do, the object is in groupA, and groupA (think of it as it’s own object) is what is in group

Looks like I got it working, was doing it slightly wrong seems like.

Here was the old code that worked with Director:

local roadGroup = display.newGroup() local sideGroup = display.newGroup() local enemyGroup = display.newGroup() local localGroup = display.newGroup(roadGroup, sideGroup, enemyGroup)  

So I thought I would be able to just add this one line to insert all these groups into the scene’s view group:

group:insert(localGroup)  

This was not working so I just tried inserting all the groups individually into “group” and deleted the “localGroup” all together, works now.

Ok - i got the concept working on a small simple demo but on trying to incorporate into game am striking some bugs.

question -  I was inserting a circle image and then loading some text within the circle (grouping it)

My assumption was that the bigger object (Circle) was my main X, Y location - but i am thinking i may be wrong in this!

  • i used to use grouping in Powerpoint/excel a lot

When using groups is it like making a photoshop layer in which the area of the group is the entire display ( 320, 480 ) and if you add objects with X,Y just lock those objects at that position on that layer - then if you want to translate you move the whole layer?

Am i right?

T.