Deluxe Edition aircraft vs series (II) and deluxe edition aircraft vs Series
The previous article introduced the general situation of the game. This article will start with the various files in the game.
Let's take a look at one of cocos2d-x 3.0's awesome features, which is much more exciting than before 3.0. Although 3.0 has been out for a long time, I still talk about this function, and I know that it is too good.
For the development of mobile games with cocos2d-x in different environments, the screen size is a relatively painful problem, such as before 3.0, In the code to modify the screen size is more troublesome, in addition, running a good size on the computer makes the mobile phone end feel a little worse.
AppDelegate. cpp is the entrance program for the entire game. The main code for setting the game size before 3.0 is as follows:
bool AppDelegate::applicationDidFinishLaunching() {// initialize directorauto director = Director::getInstance();auto glview = director->getOpenGLView();if (!glview) {glview = GLView::create("My Game");director->setOpenGLView(glview);}director->setOpenGLView(glview);#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)// a bug in DirectX 11 level9-x on the device prevents ResolutionPolicy::NO_BORDER from working correctlyglview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL);#elseglview->setDesignResolutionSize(288, 512, ResolutionPolicy::SHOW_ALL);#endifdirector->setDisplayStats(true);director->setAnimationInterval(1.0 / 60);auto scene = LoadingScene::create();director->runWithScene(scene);return true;}
The main code is:
glview->setDesignResolutionSize(288, 512, ResolutionPolicy::SHOW_ALL);
The configured size is 288 in width and 512 in length. The effect in ubuntu is not particularly good, mainly because the two sides are black and only the middle is the display of the game screen.
In 3.0, you can directly set the GLView size in the code, that is, the size of the game screen drawn,
Similarly, the applicationDidFinishLaunching () function in AppDelegate. cpp is as follows:
bool AppDelegate::applicationDidFinishLaunching() { // initialize director auto director = Director::getInstance(); auto glview = director->getOpenGLView(); if(!glview) { glview = GLView::createWithRect("My Game",Rect(0,0,320,480)); director->setOpenGLView(glview); } director->setDisplayStats(false); director->setAnimationInterval(1.0 / 60); auto scene = GameLayer::createScene(); director->runWithScene(scene); return true;}
I feel much clearer. The point is
glview = GLView::createWithRect("My Game",Rect(0,0,320,480));
You can directly set the drawing size of GLView to 320*480, Rect (320,480,) to set the coordinates and length and width of the drawn rectangle. The coordinates are () and the length is: 480, width, 320
For example, the image in the previous article is a game image running under the linux naming terminal,
I usually test the game on a mobile phone after I write the game on a computer. running the game on a computer is much faster than on a mobile phone, and I can directly operate the terminal, compilation speed is faster than eclipse.
The main code in AppDelegate. cpp is in the applicationDidFinishLaunching () function. The GameLayer scenario is generated in the function, and then the director class is called to run the scenario.
Well, this article mainly introduces some changes in AppDelegate, and introduces the GameLayer layer of the game, that is, the main logic layer of the game. Next we will introduce the various genie elements and layers in the game.
Aircraft vs. luxury edition
You can use titanium backup to back up and unmount it. You can recover it the next time you install it. In theory, any software supports titanium backup. Trial is recommended. Not just games!
What about the aircraft vs. luxury edition?
A good game. I just played it several times. Easy to use. However, it is challenging to break the limits. Nice.