hello developers …
how to pause all timers transitions of my game exactly like when you press home button (on system event ) in android and iphone
thanks in advance [import]uid: 74537 topic_id: 17102 reply_id: 317102[/import]
hello developers …
how to pause all timers transitions of my game exactly like when you press home button (on system event ) in android and iphone
thanks in advance [import]uid: 74537 topic_id: 17102 reply_id: 317102[/import]
Your question is a big vague…
But you would do the following :
pause any active transitions
stop players/enemies moving
etc
Use gamestates its the easiest way.
Have a variable like :
local paused = false
--and in all your functions simply do (at the top of them)
if paused == false then
--do whatever
end -- put the end at the end of the function
That way your functions will only execute if the paused variable is false.
[import]uid: 84637 topic_id: 17102 reply_id: 64354[/import]
thank you @david97 i am asking for how to fire applicationSuspend event not handle it
[import]uid: 74537 topic_id: 17102 reply_id: 64440[/import]
@dev.m.hantash
You don’t fire the event yourself, it’s fired by the system automatically.
You just need to listen for the event like david97 has done in his example with a Runtime:addEventListener call.
One thing to note is that the event itself doesn’t pause timers and transitions for you. You have to write that code yourself in the event handler.
Corona doesn’t support pausable timers and transitions out-of-the-box just yet, but
if you have a look in the Code Exchange, you can find some lua modules that can do these things.
http://developer.anscamobile.com/code/pausable-timers-and-transitions-speed-adjustment [import]uid: 70847 topic_id: 17102 reply_id: 64448[/import]
This is another way of pausing transitions 
http://developer.anscamobile.com/code/pausable-transitions-very-simple-method [import]uid: 64174 topic_id: 17102 reply_id: 70295[/import]
thank you @Satheesh also i want to ask if there is pause method on timer class i want to pause all timer i have used the beebe class from code exchange bug it causes problem with my game cause it does not fired every second when use it as
performAfterDelay(1,myFunction,1000)
does the subscriber edition of corona SDK Support pausing all active timer in your game ?
with respect [import]uid: 74537 topic_id: 17102 reply_id: 70334[/import]
To pause on system events, look up the System Event API’s and try:
[lua] function onSystemEvent( event )
if( event.type == “applicationExit” ) then
–Save App data
end
if( event.type == “applicationSuspend” ) then
–Save App data & state variables
–Suspend timers & functions
end
if( event.type == “applicationResume” ) then
–Load App data & set state variables
–Resume timers
end
if( event.type == “applicationStart” ) then
–Load App data, initiate app
end
end
Runtime:addEventListener( “system”, onSystemEvent ) [/lua]
-David
[import]uid: 96411 topic_id: 17102 reply_id: 64371[/import]
One method to terminate your app is to use os.exit()
http://developer.anscamobile.com/reference/index/osexit
-David
[import]uid: 96411 topic_id: 17102 reply_id: 72417[/import]
timer.pause( timername )
timer.resume( timername )
http://developer.anscamobile.com/reference/index/timer
Should be in the new general release that came out today. Mods correct me if I’m wrong. I have been using it in the daily builds and it works well. [import]uid: 31262 topic_id: 17102 reply_id: 72421[/import]