Joethemonkey101
Joethemonkey101

Reputation: 149

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 button), 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.

Upvotes: 0

Views: 902

Answers (2)

xuanweng
xuanweng

Reputation: 1939

In detail:

-(void) applicationDidEnterBackground:(UIApplication*)application {
if(gameisRunning)
{
[self pauseLayer];
}
}

=)

Upvotes: 2

Lim Gim Hong
Lim Gim Hong

Reputation: 306

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.

Upvotes: 1

Related Questions