I’m struggling with how to check if a displayGroup exists inside another displayGroup.
In my work-in-progress I have envelopes moving along a conveyor belt. I’d like it so that the user can then touch and drag a new conveyor belt for the envelope to move on (similar to the line drawing examples just that in this case I’m using a an image inside a masked display group).
I’ve worked out how to insert displayGroups into a table (note: the following doesn’t include masking):
local mainGroup = {}
for i=1, 3 do
mainGroup[i] = display.newGroup()
mainGroup[i].name = ("group"..i)
display.newImage(mainGroup[i], "conveyor.png")
end
for i=1, #mainGroup do
local tester = mainGroup[i]
if (tester.name == "group1") then
print "Exists"
else
print "Nope"
end
end
Any ideas how I can do something similar with inserting displayGoups into displayGroups and then checking if they exist against a name value? I might be wrong but I’d prefer not to do it based on the table [i] as that might change as other groups are inserted/removed. [import]uid: 27215 topic_id: 14361 reply_id: 314361[/import]