Hi,
I want make sure I do things right.
My question:
Should I nil entry (see code below) in display group after removed display object from it?
for i=layers.lasers.numChildren, 1, -1 do laser = layers.lasers[i] -- Check if laser goes out of the screen if not laser:offScreen() then laser:update( dt ) for j=layers.asteroids.numChildren, 1, -1 do asteroid = layers.asteroids[j] -- Detect collision if laser:hit( asteroid ) then ... asteroid:removeSelf() --layers.asteroids[j] = nil \<-- this line -- Remove laser laser:removeSelf() --layers.lasers[j] = nil \<-- this line break end end else -- Remove laser laser:removeSelf() --layers.lasers[i] = nil \<-- this line end end
ldurniat