You can just keep adding the creeps to different display groups without removing the display groups, because, ideally, the display groups would stick around until you killed the scene.
Here’s some of my (very amateur) depth-sorting for Crosstown Smash:
local sT = {} local fAw = 300 -- amount of display groups local fT = display.contentHeight/20 -- absolute topheight of game level local eH = display.contentHeight\*1.5 -- absolute bottomheight of game level sT.gameGroupA = {} local function setupGameGroupA() for a = fAw, 1, -1 do sT.gameGroupA[a] = display.newGroup() sT.gameGroupA[a].name = ("Game Group ".. a) sT.gameGroupA[a].itsname = ("".. a) sT.gameGroupA[a].id = a --print("sT.gameGroupA[a].x = "..sT.gameGroupA[a].x) game7:insert(sT.gameGroupA[a]) end end local function setGroupInan(obj) if obj == nil then return true end if (obj.y) \< fT then sT.gameGroupA[fAw]:insert(obj) end for i=1, fAw do if obj == nil then return true end if (obj.y) \<= (eH+10)-(2\*i) and (obj.y) \> (eH+10)-((2\*i)+2) then if obj == nil then return true end if obj ~= nil then sT.gameGroupA[i]:insert(obj) end end end if (obj.y) \> eH then sT.gameGroupA[1]:insert(obj) end end
Again, this is super-simple, your mileage may vary, blah blah blah, but the main gist is that you are running this in whichever gameloop you’re using, something like this: “sT.setGroupInan(creep[1])”
Let me know if you still need more clarification.