Hi,
I’m looking best practices for pause/resume a game which includes stop/cancel/resume timers and transitions. Any help/advice/code appreciated.
ldurniat
Hi,
I’m looking best practices for pause/resume a game which includes stop/cancel/resume timers and transitions. Any help/advice/code appreciated.
ldurniat
Hi!
Surely I would do two methods: “gamePause”, “gameResume”.
Then as regards timers and transactions depends, do you want to block everything together?
In this case, for the transitions just invoke the function without passing some parameters:
tranistion.pause()
https://docs.coronalabs.com/api/library/transition/pause.html
While the timers do not support this. So I should make a form to manage creation and pause. Some time ago I found something interesting but I still could not prove it:
However, it is not always necessary to pause everything so I would make a module that manages ids and tags so that we can group timers and transition by categories.
Transitions
Timers: timer2.*
The default timer.* library does not support tags, but timer2 does: http://www.jasonschroeder.com/2015/02/25/timer-2-0-library-for-corona-sdk/
(If you are using a recent copy of SSK2, timer 2 is already present and replacing timer.*)
Physics
enterFrame and other listeners
You can gate enterFrame and other listeners by using:
You simply check for this flag in key logic that should respect the ‘is paused’ state.
With these four solutions, you can selectively pause and resume your game objects and logic as needed.
Finally, I am working on a few products and among them is a ‘frameworks’ collection. This collection will include a set of example game modules with all of these features demonstrated:
The frameworks collection isn’t quite ready, but I’ll announce when it is.
Hi!
Surely I would do two methods: “gamePause”, “gameResume”.
Then as regards timers and transactions depends, do you want to block everything together?
In this case, for the transitions just invoke the function without passing some parameters:
tranistion.pause()
https://docs.coronalabs.com/api/library/transition/pause.html
While the timers do not support this. So I should make a form to manage creation and pause. Some time ago I found something interesting but I still could not prove it:
However, it is not always necessary to pause everything so I would make a module that manages ids and tags so that we can group timers and transition by categories.
Transitions
Timers: timer2.*
The default timer.* library does not support tags, but timer2 does: http://www.jasonschroeder.com/2015/02/25/timer-2-0-library-for-corona-sdk/
(If you are using a recent copy of SSK2, timer 2 is already present and replacing timer.*)
Physics
enterFrame and other listeners
You can gate enterFrame and other listeners by using:
You simply check for this flag in key logic that should respect the ‘is paused’ state.
With these four solutions, you can selectively pause and resume your game objects and logic as needed.
Finally, I am working on a few products and among them is a ‘frameworks’ collection. This collection will include a set of example game modules with all of these features demonstrated:
The frameworks collection isn’t quite ready, but I’ll announce when it is.