If game is closed, open pauseLayer (cocos2d iPhone development)
How do I incorporate into my AppDelegate that if a user is on a Level and exits the game (pressed home but开发者_运维技巧ton), then the next time it's opened (multitasking) it will open the pauseLayer? I don't want the game to immediately start after they have switched back to it.
In detail:
-(void) applicationDidEnterBackground:(UIApplication*)application {
if(gameisRunning)
{
[self pauseLayer];
}
}
=)
inside applicationDidEnterBackground, add a line of code to check whether the game is running. if the game is running, open the pauseLayer. this way when the player open it from multitasking the game will be paused.
精彩评论