赵云格斗从2.0移植到3.3版本出现的问题

最近在学习Cocos2D-x,在Evankaka的博客

http://blog.csdn.net/evankaka/article/details/42043509

下载了赵云要格斗的代码,在本地导入的时候出现了一系列的问题,在解决问题的过程也学到不少。还是菜鸟一枚,很多问题只是简单解决了,并没有深究,首要还是能跑通吧。。。在这里感谢Evankaka的无私奉献

1.无法打开包含文件extensions/ExtensionExport.h

(1)在你自己的头文件中加入#include ”cocos-ext.h"
(2)使用命名空间USING_NS_CC_EXT;
(3)选中工程右键“属性”->"配置属性“->"c/c++"->"常规”->"附加包含目录"中添加“”$(EngineRoot)

2.error C2143: 语法错误USING前缺少“;” :

#include "Hero.h"
USING_NS_CC; 
USING_NS_CC_EXT;
其实这个是自己的疏忽Hero.h文件的结尾时候用的是中文“;”

3.

	 CCArray* frameArray= CCArray::createWithCapacity(num);
	 unsigned int i;
	 for(i=2;i<=num;i++)
	 {
		 CCSpriteFrame* frame=m_frameCache->spriteFrameByName(CCString::createWithFormat("run_%d.png",i)->getCString());
		 frameArray->addObject(frame);
	 }
	 //使用列表创建动画对象
	 CCAnimation* animation=CCAnimation::createWithSpriteFrames(frameArray);
createWithSpriteFrames方法中的参数是Vector出现了CCArray转化为Vector的错误
修改后的代码:
<pre name="code" class="cpp">	 Vector<SpriteFrame*> vec1(num);
	 unsigned int i;
	 for(i=2;i<=num;i++)
	 {
		 CCSpriteFrame* frame=m_frameCache->spriteFrameByName(CCString::createWithFormat("run_%d.png",i)->getCString());
		 vec1.pushBack(frame);
	 }
	 //使用列表创建动画对象
	 CCAnimation* animation=CCAnimation::createWithSpriteFrames(vec1);
 
 


猜你喜欢

转载自blog.csdn.net/adobeid/article/details/43282467