开发者

If game is closed, open pauseLayer (cocos2d iPhone development)

开发者 https://www.devze.com 2023-02-12 00:44 出处:网络
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 pauseLaye

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号