Dear,
I’ve some timers such as :
TimerShowbee = timer.performWithDelay( 4000, addbee,1) TimerShowbee1 = timer.performWithDelay( 30000, addbee,1) TimerShowbee2 = timer.performWithDelay( 54000, addbee,1) TimerShowbee3 = timer.performWithDelay( 16000, addbee2,1) TimerShowbee4 = timer.performWithDelay( 19000, addbee2,1) TimerShowbee5 = timer.performWithDelay( 36000, addbee2,1) TimerShowbee6 = timer.performWithDelay( 44000, addbee2,1) TimerShowbee7 = timer.performWithDelay( 47000, addbee2,1) TimerShowbee8 = timer.performWithDelay( 9000, addbee3,1) TimerShowbee9 = timer.performWithDelay( 36000, addbee3,1) TimerShowbee10 = timer.performWithDelay( 54000, addbee3,1)
So, I’ve build a function called pauseGame() :
function pauseGame(event) --if end of touch event if(event.phase == "ended") then timer.cancel(TimerShowbee) timer.cancel(TimerShowbee1) timer.pause(TimerShowbee2) timer.pause(TimerShowbee3) timer.pause(TimerShowbee4) timer.pause(TimerShowbee5) timer.pause(TimerShowbee6) timer.pause(TimerShowbee6) timer.pause(TimerShowbee7) timer.pause(TimerShowbee8) timer.pause(TimerShowbee9) timer.pause(TimerShowbee10) timer.cancel(TimerMovebee) physics.pause() --physics.removeBody( player ) --make pause button invisible pauseBtn.isVisible = false --make resume button visible playBtn.isVisible = true -- indicates successful touch return true end end
And another function which resume the game :
function resumeGame(event) if(event.phase == "ended") then --resume physics physics.start() pressed=false --make pause button visible pauseBtn.isVisible = true --make resume button invisible playBtn.isVisible = false timer.resume(TimerShowbee) timer.resume(TimerShowbee1) timer.resume(TimerShowbee2) timer.resume(TimerShowbee3) timer.resume(TimerShowbee4) timer.resume(TimerShowbee5) timer.resume(TimerShowbee6) timer.resume(TimerShowbee7) timer.resume(TimerShowbee8) timer.resume(TimerShowbee9) timer.resume(TimerShowbee10) timer.resume( TimerMovebee ) return true end end
The problem is about the delay of each timer, I think there is a real problem of “synchro” because the objects did’nt respect the delays once I put on pause & resume game.
Thank you