IOS Dev (66) basic considerations for a mobile game program
- Blog: http://blog.csdn.net/prevention
- Author: darui Ge
- From:
Learn iPhone and iPad cocos2d Game Development
1. Start the handler program in the basic process.
applicationDidFinishLaunching
Switch the program to the background
applicationDidEnterBackground
Program running ended
applicationWillTerminate
2. Basic settings allow users to set device directions
[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
Animation frame period
[[CCDirector sharedDirector] setAnimationInterval:1.0/60];
It is your responsibility to keep the game running at a high frame rate.
When you set a lower frame rate and the game can maintain a stable frame rate, the user experience will be much better than using a higher but unstable frame rate.
Ideally, your game should run at a frame rate of 60 frames per second, especially those action games. Some games, such as most puzzle games, can meet the requirements by 30 frames per second.
View FPS
[[CCDirector sharedDirector] setDisplayFPS:YES];
Differences between logs in Debug and Release
Use CCLog instead of NSLog. The latter also exists in the Release version, which affects program running.
3. Defensive Programming for type conversion of knowledge points
CCNode * node = [self getChildByTag: 13]; // Defensive Programming: Verify that the returned node is the NSAssert object of the CCLable class ([node isKindOfClass: [CCLabel class], @ "node is not a CCLabel! ");
What configuration test software is used?
When testing, try to use Release Configuration instead of Debug Configuration.
-
Reprinted please indicate from: http://blog.csdn.net/prevention