Hi I am spawning various characters at different times. Right now the newly spawn character spawns in front of the old one that was spawned just before it. What is the way to make it spawn behind?
if all characters are in the same group, insert the new character and then reinsert all the characters that were spawned earlier
you could also place them in different groups. if groupA was created before groupB, then a character in groupA is behind a character in groupB, no matter when the characters were spawned
You can also specify the an index for group:insert(); specifying an index of “1” will always put the display object at the bottom of the group’s visual stack.
local group = display.newGroup()
local img = display.newImage("img1.png")
group:insert(img)
local img2 = display.newImage("img2.png")
group:insert(1, img2) -- inserts img2 at the bottom of the stack
-- group:insert(img2) -- insert img2 at the top of the stack
Tim [import]uid: 8196 topic_id: 2245 reply_id: 6801[/import]