I have a function that draws a bunch of objects. Looks like this:
function DungeonContentsCollection:draw() pushMatrix() pushStyle() for tile,entries in pairs(self:drawingOrder()) do if tile:isVisible() then local gc = tile:graphicCenter() for i,object in ipairs(entries) do zLevel(5) -- breaks visibility?? spriteMode(CENTER) object:draw(false, gc) end end end popStyle() popMatrix() end
When the zLevel is in there, objects drawn in the loop sometimes show up and sometimes do not, depending on how the Player moves around near them. There is no obvious pattern, but it seems that if it ever appears while player is on a given tile, it will always appear, and vice versa. So it’s not random with moves, but dependent on where you move.
There is no other call to zLevel in the whole program.
I can do without the call, because I am (finally) drawing in increasing z-level order, but what the heck could possibly be going on that could do this? Unless zLevel is well and truly borked?
Ideas solicited. Thanks!