Hi,
I want to remove objects after n seconds so how to remove it in 3 seconds. I have tried this but it says starter a nil value.( Starter is the name of scene). I only changed name of scene in this code from Game.
local function destroyObj(obj)
display.remove(obj)
obj=nil
end
test = display.newRect(1120, -50,20,20)
physics.addBody(test, “dynamic”, {density = 1.0, friction = 10, bounce = .5})
starter:insert(test)
test.collision = function(self, event)
if ( event.phase == “began” ) then
timer.performWithDelay(5000, function()
destroyObj(self)
end, 1)
end
end
test:addEventListener( “collision”, test )
end
I also tried
local function remove()
“here I display object”
display.remove( object )
timer.performWithDelay( 3000, remove, 0)
but it also not working!