Hello every one,
I want to insert same object in two different group but i m getting one problem it will insert only in one group which is last one.
can anyone help out from this problem
Hello every one,
I want to insert same object in two different group but i m getting one problem it will insert only in one group which is last one.
can anyone help out from this problem
This is a bad idea both practically and conceptually. Groups should be used to organise things in views in simple hierarchies. Do you want to group them together for another reason ?
If you are (say) keeping a subset of a group you need to either tag them or put references in a table.
As @paulscottrobson hints, objects can only exist in one display group at any time. If you need them to be “grouped” as a unit, but still retain their own group, you’ll need to place each one in a group, then nest that group in a parent group.
Brent
function scrollGrass(self, event)
if self.y < -600 then
self.y = 240
else
if(self.speed==nil)then
else
self.y = self.y - self.speed
end
end
end
Grass1.enterFrame = scrollGrass
Runtime:addEventListener(“enterFrame”, Grass1)
Grass2.enterFrame = scrollGrass
Runtime:addEventListener(“enterFrame”, Grass2)
In above Grass1,Grass2 is object with one property called speed which i m using in enter frame to move from bottom to top
I use the above code move two image continuously. So i want move why images as same.
But here I am getting this images from my server.
thats why i am adding my images to two groups so that i can move them continuously.
If u can suggest me good logic than please share it
Think of it like a directory tree:
PARENT GROUP | --- CHILD GROUP 1 --- CHILD GROUP 2 | --- OBJECT 1 --- OBJECT 2 --- CHILD GROUP 3
Then, for example, you just move “CHILD GROUP 2” around, and the objects inside will move together.
in this case there will be a gap, continuation of moving object will not be there.
This is a bad idea both practically and conceptually. Groups should be used to organise things in views in simple hierarchies. Do you want to group them together for another reason ?
If you are (say) keeping a subset of a group you need to either tag them or put references in a table.
As @paulscottrobson hints, objects can only exist in one display group at any time. If you need them to be “grouped” as a unit, but still retain their own group, you’ll need to place each one in a group, then nest that group in a parent group.
Brent
function scrollGrass(self, event)
if self.y < -600 then
self.y = 240
else
if(self.speed==nil)then
else
self.y = self.y - self.speed
end
end
end
Grass1.enterFrame = scrollGrass
Runtime:addEventListener(“enterFrame”, Grass1)
Grass2.enterFrame = scrollGrass
Runtime:addEventListener(“enterFrame”, Grass2)
In above Grass1,Grass2 is object with one property called speed which i m using in enter frame to move from bottom to top
I use the above code move two image continuously. So i want move why images as same.
But here I am getting this images from my server.
thats why i am adding my images to two groups so that i can move them continuously.
If u can suggest me good logic than please share it
Think of it like a directory tree:
PARENT GROUP | --- CHILD GROUP 1 --- CHILD GROUP 2 | --- OBJECT 1 --- OBJECT 2 --- CHILD GROUP 3
Then, for example, you just move “CHILD GROUP 2” around, and the objects inside will move together.
in this case there will be a gap, continuation of moving object will not be there.