Starting a cocos2d game with initial gameplay as background
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 t开发者_运维百科ried 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.
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.
精彩评论