I looked at the game template which has the pause button function, however i got confused as how i will pause the game. so if it is possible can someone advice me about the basic of how to pause a game that have or does not have timer.
@a00za, generally games are written with a central main loop that runs the game. Apart from this some might use an ENTER_FRAME, some a timer. Now the question is how are your running your game, based on that you could get advice on how to pause your game.
basically you have to pause all timers luckily you can use Timer.pauseAll() for this, you need to pause all tweens if you are using that, stop all enterFrame events and block all touches little bit hard if you are trying this first time
You could also potentially use a boolean variable. Then in all the code where stuff happens, test this variable. You'll have to decide whether or not to also remove listeners etc. depends on what is going on in your game.
Comments
Likes: a00za
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
Likes: a00za
Eg. at game start,
game_paused = false
someone clicks pause btn:
game_paused = true
in main code where stuff happens:
if not game_paused then
do your stuff here
end