Ok,
This is getting messy B)
Here’s what I want to do. Have an object generated. If it’s colliding remove it if not it lives!
Object is generated off a double tap so adds:
Runtime:addEventListener (“enterFrame” , update)
function update(event)
if (count > 0) then
timer.performWithDelay(1, do_later) …
I *assume* I can’t remove an event listener whilst in an event listener hence the timer delay
local function do_later(event)
Runtime:removeEventListener(update)
loader:cancelBeginOrEndCollisionCallbackBetweenTags(placing.lhTag,“static”, beginend_collision)
loader:cancelBeginOrEndCollisionCallbackBetweenTags(placing.lhTag,“fruit”, beginend_collision)
print(placing)
object.kill(placing)
end
This do_later seems to be getting called twice! (the print happens twice) even though the object is dead!
function kill(obj)
table.remove(obj.obj_table,obj.index)
obj:removeSelf()
obj = nil
end
For the record my kill routine.
I can’t see an issue here but Corona spouts: “ERROR: Attempt to remove an object that’s already been removed from the stage or whose parent/ancestor group has already been removed.”
Presumably there’s something I don’t understand or have missed so any help as always appreciated
Cheers