From c505b38ac0ad593ee7c4e56895a06a69878a88d3 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Mon, 5 Sep 2011 00:39:29 -0400 Subject: Made game automatically pause when resigning active state Previously, the game paused when it entered the background. Now, it pauses when the game is about to become inactive, which is the proper thing to do. --- Classes/Cart_CollectAppDelegate.m | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Classes/Cart_CollectAppDelegate.m b/Classes/Cart_CollectAppDelegate.m index 1a6759c..25a2aa4 100755 --- a/Classes/Cart_CollectAppDelegate.m +++ b/Classes/Cart_CollectAppDelegate.m @@ -134,6 +134,13 @@ - (void)applicationWillResignActive:(UIApplication *)application { [[CCDirector sharedDirector] pause]; + + [[NSUserDefaults standardUserDefaults] synchronize]; + + if ([[CCDirector sharedDirector] runningScene].tag == GAME_SCENE) + { + [((GameMode*)[[[CCDirector sharedDirector] runningScene] getChildByTag:GAME_LAYER]) pause]; + } } - (void)applicationDidBecomeActive:(UIApplication *)application { @@ -146,13 +153,6 @@ -(void) applicationDidEnterBackground:(UIApplication*)application { [[CCDirector sharedDirector] stopAnimation]; - - [[NSUserDefaults standardUserDefaults] synchronize]; - - if ([[CCDirector sharedDirector] runningScene].tag == GAME_SCENE) - { - [((GameMode*)[[[CCDirector sharedDirector] runningScene] getChildByTag:GAME_LAYER]) pause]; - } } -(void) applicationWillEnterForeground:(UIApplication*)application { -- cgit 1.4.1