Cocos2d-x 3.0 Game Example Learning notes "parkour" transplanted to Android phone

Source: Internet
Author: User

Description: Here is the reference: Xiaofeng Moon predecessors of the blog. He is a parkour tutorial that will be a cool net. Rewrite with the Cocos2d-x 2.X version number, now I am learning cocos2d-x3.0 and then use Cocos2d-x 3.0 rewrite, and make related notes

All right. Nothing has been done since the last run of parkour. Mainly fixed a little bit of bugs, but also in the corresponding article to make the corresponding changes.

It's just that you can just watch and play on the window. Then try to get the phone to try--ok. The newborn calf does not face, oh no! Not afraid of spraying.

Here's a record of my transplant process. ( This will use a new size resource.) will be all packaged later ).

。。

Here are a few things to talk about:

1. A little trouble.

2. A simple, rough way to transplant.

3, the transplant need to prepare-----is how to succeed in transplant

First look at my phone:


So look at our problems today:.

。 Our original implementation of those resources on the Win32, not through the screen to adapt to the relevant knowledge, put on the mobile phone is definitely not appropriate, just 640*320, now a lot of mobile phones almost the same is 4.0 inch screen above, the resolution is also very much 1200 (about) *800 (about). But there is a lack of knowledge about screen adaptability. Let me have to find a shortcut to see the original from the previous download of project, another resource is for the ipad, look at the size of those pictures ...

Haha, even the size is not too poor to go there.

。。

As a matter of course, the simple and rude Way comes: 1. Download new resources to replace the original resources: This includes: new resources. The new code (it also changes some size for the porting). Generated apk Http://pan.baidu.com/s/1gd5TzPLDo not know is not today Baidu cloud a bit of a problem.

。。

Upload several times have failed, assuming that someone can not be able to stay in the mailbox here. I send seeds, oh no.

。 Sent to you

2, what we need to do is change some of the major size. To adapt to your mobile phone 3, the third is nothing to say, anyway, in the code, and before the difference between the code is not much.

The main is to spit trough a bit. Kiss..... Can you imagine how much trouble this is? The simple and brutal way to do this is to change the size of a place. I'll compile Android once again and then connect the phone. Install APK, test. Find the problem, change size, compile Android-----loop n times.

。。

The little buddy who compiled Android should know that compiling is how slow, multi-card ....

All right, here, let's see how we can succeed: first, we use the button, that is, to use the libExtensions.lib, this should be called adding a third-party library it!

。 We don't know what's on this big thing first. Simple to do with me:

1. Open the "project folder" \proj.android\jni inside the android.mk ... Change to: The red part is the code that needs to be added
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = Libcocos2dcpplocal_src_files: = hellocpp/main.cpp \<span style= "color: #ff0000;" >.. /.. /classes/appdelegate.cpp. /.. /classes/base.cpp. /.. /classes/basemanager.cpp. /.. /classes/coin.cpp. /.. /classes/gameover.cpp. /.. /classes/mainscene.cpp. /.. /classes/playscene.cpp. /.. /classes/rock.cpp. /.. /classes/runner.cpp</span>local_c_includes: = $ (Local_path)/. /.. /classes\<span style= "color: #ff0000;" > $ (local_path)/. /.. /cocos2d/cocos/2d/. /.. /extensions \</span>local_whole_static_libraries: = cocos2dx_staticlocal_whole_static_libraries + = Cocosdenshion_staticlocal_whole_static_libraries + = Box2d_static<span style= "color: #ff0000;" >local_whole_static_libraries + = COCOS_EXTENSION_STATIC&LT;/span>include $ (build_shared_library) $ (call import-module,2d) $ (call Import-module,audio/android) $ (call import-module,box2d) <span style= "color: #ff0000;" >$ (call import-module,extensions) </span>
Note that the corresponding code is added here. Don't get a few more lines or something.

About this thing, I am not familiar with, but before it seems that because of some more lines, the compilation process error

2, then cmd to the project folder, enter Cocos compile-p android-j
OK..

。。 It's so simple.

。。。

Then, you can wash and sleep ...

This thing compiles more than 10, 20 minutes.

then appears similar to the following: (Here is what I have been staying) mainly to see:BUILD Successfulso congratulations. You've compiled it successfully.
you will then be able to see a run-debug.apk in the project folder under \proj.android\bin.

。 You'll be able to copy it to your phone.

。。


Ok. The main point here is to say. There are no other third-party libraries or anything else in the game.

。 You don't need to change android.mk. For example here, we use the extension library in the game, (is not the third-party library I do not know) ... Then you need to change android.mk to add something. Most of these things are online ....


Okay, all right.

。 It's over here again.

Personal ignorance point of view, welcome to correct and discuss!

Cocos2d-x 3.0 Game Example Learning notes "parkour" transplanted to Android phone

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.