issue related to timer.performwithdelay()

Hey!! 

I’m developping a game which is almost done but while testing I’m facing an issue where timer.performWithDelay is not calling the function after the set delay time.

For ex:

function destroy()

end

timer.performWithDelay( 200, function() destroy() end,1)

here timer call destroy function somtimes after 218 ms,564ms or even 1000ms.

which effect my game performance.

plz help me out with solution or  is their any alternative of timer.performWithDelay.

Thanks in adv.

Regards,

Surabhi

  1. What version of Corona are you using?  i.e. I’m using 2015.2753 as I type this.

  2. I’m sure performWithDelay() is OK.

The question is, “how many times are you calling that particular line of code?”

Put a print statement in front and verify you only call it (set up the timer) once.  My guess is you are calling it multiple times:

print("About to call timer.performWithDelay() @ ", system.getTimer() ) timer.performWithDelay( 200, function() destroy() end,1)

Hii Roaminggamer, thanks for replying.I have tried this and I am calling it only once.Afer testing  a lot I found that issuse occures after changing the scene that is from gameScene --> pauseScene --> gameScene. Within the same scene it is working v fine but after changing the scene or resuming the game this promble occures.

May be I’m missing few lines of code which is required while changing the scene.

  1. What version of Corona are you using?  i.e. I’m using 2015.2753 as I type this.

  2. I’m sure performWithDelay() is OK.

The question is, “how many times are you calling that particular line of code?”

Put a print statement in front and verify you only call it (set up the timer) once.  My guess is you are calling it multiple times:

print("About to call timer.performWithDelay() @ ", system.getTimer() ) timer.performWithDelay( 200, function() destroy() end,1)

Hii Roaminggamer, thanks for replying.I have tried this and I am calling it only once.Afer testing  a lot I found that issuse occures after changing the scene that is from gameScene --> pauseScene --> gameScene. Within the same scene it is working v fine but after changing the scene or resuming the game this promble occures.

May be I’m missing few lines of code which is required while changing the scene.