Making object dissapear after a period of time

Hello, I am making a whac a mole game and the idea is i want the moles to dissapear after a set period of time. I was trying using performWithDelay but because i use a function that receives parameters i think that is a no no. So what i am asking is this something that can be able to make an object dissapear and be removed as well after a set period of time. [import]uid: 127101 topic_id: 27917 reply_id: 327917[/import]

with a wrapper function, you can send parameters through a performWithDelay call

function spawnSomething (arg1, arg2)  
 print ("arg1: "..arg1.." / arg2: "..arg2)  
end  
  
function startTimer ()  
  
 local foo = 100  
 local bar = 200  
  
 local function wrapper ()  
 spawnSomething (foo, bar)  
 end  
  
 timer.performWithDelay( 1000, wrapper , 10 )  
end  

-finefin
[import]uid: 70635 topic_id: 27917 reply_id: 113005[/import]

I would use a transition. http://gamedevnation.com/game-development/moving-sunbeams-in-corona-sdk/

In that link the guy uses a transition to in order to change the alpha of the object. Then if you want you can do a transition with on complete that sends it to a function that changes the isVisible property to false or you can remove the object like that. [import]uid: 49863 topic_id: 27917 reply_id: 119222[/import]