Timer Problem

hi guys,

i developed one shooting game .it’s completely depending on game timer.
currently i am using 704 build. initially i was used 746 build that time Facebook is not working properly .so, i asked suggestion to corona developer they suggested 704 build . after Facebook is working correctly.

But, i have one big problem in my game . i am using in-app purchase for
buy a new type of gun.after purchased game will work 5 seconds correctly and then all the timer will pause automatically(hang)include my game timer also . after 10 seconds game will start normally .

because i paused my game timer when user click the pause button . but here i can’t understand how all the game timer stop .

some time its happened before in app purchase…

give me a solution ?

please help me…

thanks… [import]uid: 119468 topic_id: 22393 reply_id: 322393[/import]

Can you post up some code? This sounds like a logic error [import]uid: 84637 topic_id: 22393 reply_id: 89315[/import]

Danny, thanks for reply…


Here my Sample Code
1.gameTimer
gameTimer = timer.performWithDelay(1000,CallGameTimer,0)

  1. I have totally three character in my game . they are continuously running in certain area ,suddenly they stop some random area that time player will shoot them and get the score.
    function CallFirstCharacter()
    ----- 1 RunningCode here ----
    end
    function CallSecondCharacter()
    ----- 2 RunningCode here ----
    end
    function CallThirdCharacter()
    ----- 3 RunningCode here ----
    ends
    timer1 = timer.performWithDelay(100,CallFirstCharacter,0)
    timer2 = timer.performWithDelay(100,CallSecondCharacter,0)
    timer3 = timer.performWithDelay(100,CallThirdCharacter,0)

pause timer code here

PauseFunction = function(event)
if event.phase == “ended” then
if gameTimer ~= nil then
timer.pause(gameTimer)
end
if timer1 ~= nil then
timer.pause(timer1)
end
if timer2 ~= nil then
timer.pause(timer2)
end
if timer3 ~= nil then
timer.pause(timer3)
end
end
end
pause:addEventListener(“touch”,PauseFunction)

ResumeFunction = function(event)
if event.phase == “ended” then
if gameTimer ~= nil then
timer.resume(gameTimer)
end
if timer1 ~= nil then
timer.resume(timer1)
end
if timer2 ~= nil then
timer.resume(timer2)
end
if timer3 ~= nil then
timer.resume(timer3)
end
end
end
Resume:addEventListener(“touch”,ResumeFunction)
store = require(“store”)

function storeTransaction( event )
local transaction = event.transaction
if transaction.state == “purchased” then
local alert = native.showAlert(“InAppPurcahse”,“Item was purchased”,{“ok”},onComplete)

elseif transaction.state == “restored” then

elseif transaction.state == “cancelled” then

elseif transaction.state == “failed” then

else

end
store.finishTransaction( transaction )
end

InAppScreenPurchase = function(event)
store.init( storeTransaction )
store.purchase( {“com.Change.NewGun”})

end
PurcahseButInApp:addEventListener(“touch”,InAppScreenPurchase)

After in app purchase all timer will pause automatically.

thanks

[import]uid: 119468 topic_id: 22393 reply_id: 89566[/import]