Cocos2dx Game Development Series notes 16: Come to a Demo: cocos2dx version porting in meow Wang war

Source: Internet
Author: User

Late bone (http://blog.csdn.net/iamlazybone QQ: 124774397)


Friday night

This is the favorite time for office workers.

Run Diablo 2 on win8.1 last night.

After the modification is compatible, it runs perfectly.

So I went in with nostalgia and made several tasks.

Modified the skills skill table file in the data \ global \ excel directory.

Witch skill changes are messy

Cool to explosive




OK. Today I am running an example of a popular online website: Click here for download

Although I have introduced a lot on the internet, you don't have to think about it yourself, but their experience is still theirs.

It is estimated that it is similar to the previous airplane-hitting game.

Start

Reporting Environment: vs2012, cocos2dx2.2, win8.1



First, create an empty project using a script,

Then, copy the downloaded source code and resources to the project.

Return to vs to import existing items and run

Then, change the bug.

Bug1:

1> d: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ appdelegate. cpp: warning C4819: The file contains characters that cannot be expressed in the current Code Page (936. Save the file as Unicode to prevent data loss.

Right-click the project property c ++ advanced disable specific warning Add the reported 4819 re-compile this warning will be gone


Bug2

D: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ gameaboutscene. h (29): error C4430: Missing type specifier-assumed to be int. Note: C ++ does not support default int
Add an int before the method.


Bug3

D: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ gamescene. cpp (90): error C2665: "cocos2d: CCSprite: create": none of the three reloads can convert all parameter types.

blood3 = CCSprite::create(ui->getTexture());

The initialization function of CCSprite may be changed, followed by getTexture, so you can use CCSprite: createWithTexture.


Bug4

D: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ gamescene. cpp (74): error C2665: "cocos2d: CCArray: create": none of the two reloads can convert all parameter types.

enemys=CCArray::createWithCapacity(3);    //enemys = CCArray::create(3);
Modify the CCArray initialization method.

--------------------------

With this change, I suddenly felt that these bugs were just a problem with the cocos2dx version.

Why don't I try the next version? Haha, too lazy


Re-import the new project code.

No errors are reported, but there are still errors.


Bug5

1> d: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ gamescene. cpp (30): warning C4018: "<": Signed/unsigned Mismatch
for(int i = 0;i < enemybullets->capacity();i ++){
Change I to unsigned.


Bug6

D: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ gamemenuscene. cpp (132): error C2228: The left side of ". c_str" must have a class/structure/Union
CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("background.mp3")
Change fullPathFromRelativePath ("background#") to fullPathForFilename ()


Bug7

1> d: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ gameobjhero. cpp (107): error C2039: "locationInView": Not a member of "cocos2d: CCTouch"
// CCPoint touchPoint = touch-> locationInView ();

Changed:
CCPoint touchPoint = touch-> getLocationInView ();


Bug8

1> d: \ java \ cocos2d-x-2.2 \ projects \ maowang \ classes \ gameobjhero. cpp (86): error C3861: "CCRectContainsPoint": the identifier is not found
//return CCRect::CCRectContainsPoint(rect(), convertTouchToNodeSpaceAR(touch));
Change to: return rect (). containsPoint (convertTouchToNodeSpaceAR (touch ));


Bug9

1> GameScene. obj: error LNK2019: the external symbol that cannot be parsed "public: void _ thiscall GameEnemyBullet: setIsNotVisable (class cocos2d: CCNode *)"(? SetIsNotVisable @ GameEnemyBullet @ QAEXPAVCCNode @ cocos2d @ Z). This symbol is used in the function "public: virtual bool _ thiscall GameMain: init (void )"(? Referenced in init @ GameMain @ UAE_NXZ)

The last bug failed to be fixed. The bug was blocked first and the game screen was finally displayed,

//mybullet->setIsNotVisable(mybullet);



But it will be down after a while.

It seems that the last sentence cannot be commented out directly.

void GameHeroBullet::setIsNotVisable(CCNode *pSender){this->setVisible(false);isvisable = false;this->stopAllActions();}
Take a closer look at this method. In fact, the pSender parameter is useless.

Remove the parameter, OK, but it can only run for a short time.


Bug10

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call.  This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
To be resolved

Okay, no persistent. First.


------------------- Spacecraft departure --------------------

Cocos2dx Game Development Series notes 15.1: Add a virtual joystick SneakyInput

Cocos2dx Game Development Series notes 14: a horizontal boxing game Demo-lower (let the game run on the mobile phone)

Cocos2dx Game Development Series note 13: a horizontal boxing game Demo-Medium

Cocos2dx Game Development Series Note 12: a horizontal boxing game Demo-on

Cocos2dx Game Development Series note 11

Cocos2dx Game Development Series notes 10: Exploring the legend of war

Cocos2dx Game Development Series notes 9: Running legend of war on android phones and solving the problem of adaptive resolution

Cocos2dx Game Development Series notes 8: Start a shooting game named "legend of war "//

Cocos2dx Game Development Series notes 7: A simple and cool-running game "Lori run" for digestion (download link)

Cocos2dx Game Development Series Note 6: how to run the example of "Lori run" on vs and mobile phones

Cocos2dx Game Development Series notes 5: Continue to polish the ninja darts ghost

Cocos2dx Game Development Series notes 4: how to add a new Scene class?

Cocos2dx Game Development Series notes 3: A test with a knife-> a Demo of a ninja darts ghost

Cocos2dx Game Development Series NOTE 2: What is in the demo of a newly created cocos2dx

Cocos2dx Game Development Series Notes 1: a brand new start, cocos2dx2.2 + ndkr9 + Cygwin + vs2012 Game Development Environment Construction

------------------ Ship arrival --------------------


Finally, let's look at the zhezhe with his side (the low-key zhezhe on the right)

Zhe, the famous YIYI, the craftsman, the artistic fan, the craftsman, the founder of YiYi Miao she, has his own ideas.



Related Article

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.