tags:

views:

230

answers:

1

Hi All,

Id like to start my game, with the initial game play layout as the background, with a buttons layer over the top with maybe 'Tap to start' and a high score etc.

and similarly, when the game finishes, id like to just 'pause' the final game play layout and overlay a game over menu of sorts.

I tried calling [[CCDirector sharedDirector] pause] as the last line of the appDidFinishLaunching which didnt seem to have any effect.

Is there a better way trying to do this? I dont really like my initial approach.

A: 

You actually shouldn't be using pause to pause the gameplay for a pause/game over menu as I believe this will disable all input and major processing for your scene. From the Cocos docs...

CCDirector pause pauses the running scene. The running scene will be drawed but all scheduled timers will be paused While paused, the draw rate will be 4 FPS to reduce CPU consuption

Doesn't mention input but I'm pretty sure it won't be processed while paused seeing as much of the processing is cut down. Instead of using CCDirector pause just set a flag in one of your classes that is flipped when the user gets game over. Then in your main game loop check the status of that flag to determine if you should display a game over screen. The same can be done for when the game is paused. If you'd like an example implementation of this strategy let me know.

Rob Segal
hi rob,ive used the ccdirector pause. I also was concerned that ALL input would be ignored but it seems that touches are still handled appropriately.The FPS is dropped to 4.0FPS, draw is still called but the selector given to the scheduler is not called, so this is exactly what i was after.I still think my use of pause is a little smelly, however its serving a purpose and everything seems to be running smoothly.
boz
Well you have proved me wrong! Glad the input works and yeh I think you're method is a bit "smelly" as you put it. I think my suggested way of a flag is more appropriate but if you are happy with the results your getting than I am happy to.
Rob Segal