CoderzHeaven

April 26, 2012

Pause And Resume iPhone Game Using Cocos2D

More than usually we need to apply the functions of Pause and Resume/Play for our games. In Mac’s cocos2D programming it’s more than simple. Simply use the following code for Pause & Resume where ever you want!

/*For Pausing the game*/

[[CCDirector sharedDirector] pause];[self pauseSchedulerAndActions]; //Call for pausing all schedulers and actions

/*For Resuming/Playing back the game*/

[[CCDirector sharedDirector] resume];[self resumeSchedulerAndActions]; // Call for resuming all schedulers and actions

🙂

Leave a Reply Cancel reply

');isvalidName=false;}else{isvalidName=true;$n(element).html('');}}else{var element=$n("#yourname").next().next();$n(element).html('
This field is required.
');emailAdd=false;}if(emailAdd!=""){var element=$n("#youremail").next().next();if(emailAdd.toLowerCase()=='Email'.toLowerCase()){$n(element).html('
This field is required.
');isvalidEmail=false;}else{var JsRegExPatern = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/if(JsRegExPatern.test(emailAdd)){isvalidEmail=true;$n(element).html('');}else{var element=$n("#youremail").next().next();$n(element).html('
Please enter valid email address.
');isvalidEmail=false;}}}else{var element=$n("#yourname").next().next();$n(element).html('
This field is required.
');isvalidEmail=false;}if(isvalidName==true && isvalidEmail==true){$n(".AjaxLoader").show();$n('#mysuccess_msg').html('');$n('#mysuccess_msg').hide();$n('#myerror_msg').html('');$n('#myerror_msg').hide();var nonce ='609eb198fa';var url = 'http://www.coderzheaven.com/wp-content/plugins/email-subscribe/';var email=$n("#youremail").val();var name =$n("#yourname").val();var str="action=store_email&email="+email+'&name='+name+'&sec_string='+nonce;$n.ajax({type: "POST",url: 'http://www.coderzheaven.com/wp-admin/admin-ajax.php',data:str,async:true,success: function(msg){if(msg!=''){var result=msg.split("|");if(result[0]=='success'){$n(".AjaxLoader").hide();$n('#mysuccess_msg').html(result[1]);$n('#mysuccess_msg').show();setTimeout(function(){$n.fancybox_ns.close();},2000);}else{$n(".AjaxLoader").hide();$n('#myerror_msg').html(result[1]);$n('#myerror_msg').show();}}}});}}