Create new object based on timer

Hi, I’m a complete noob with Coroner and I’m still trying to get my head around the language so apologies if this seems like a stupid question.
What I have is an object (small circle) that appears from one side of the screen at a random point and moves across to the other side and is removed once it has disappeared off the side (or if it is tapped). What I would like to do is a have a timer that creates a new object every x seconds. I’m just not entirely sure how to go about it.
Any help at all would be appreciated. Thanks. [import]uid: 7841 topic_id: 1514 reply_id: 301514[/import]

Hi Appletreeman

I am also a noob so don’t’ consider this the perfect answer especially as I am typing this on a PC and have not tested the code. But from the API here is what it appears you need to try:

  
local createNewObject = {}  
function createNewObject:timer( event )  
  
 -- Put your code here to create the new object  
  
end  
   
timer.performWithDelay(1000, createNewObject, 0)  
  

Here is the syntax:

timer.performWithDelay( delay, listener [, iterations] )

An optional parameter iterations specifies the number of times listener is invoked. By default, it is 1; pass 0 if you want it to loop forever.

Hope that helps

Paul [import]uid: 7863 topic_id: 1514 reply_id: 4469[/import]