分析Cocos2d-x横版ACT手游源代码 5、3D世界

分析Cocos2d-x横版ACT手游源代码 5、3D世界,第1张

概述.h文件 #ifndef _NF_3D_WORLD_LAYER_HEAD_#define _NF_3D_WORLD_LAYER_HEAD_#include "../publicdef/PublicDef.h"#include "../gameunit/NFWorld3D.h"#include "../datamanager/NFEnemyWave.h"class CNF3DWorld
.h文件
#ifndef _NF_3D_WORLD_LAYER_head_#define	_NF_3D_WORLD_LAYER_head_#include "../publicdef/PublicDef.h"#include "../gameunit/NFWorld3D.h"#include "../datamanager/NFEnemyWave.h"class CNF3DWorldLayer : public CNFWorld3DLayer,public CMSgReceiver,public CMSgSender{public:	//标签	enum	{		enTagMIDTMXMap = 10000,enTagTMXMap1,enTagTMXMap2,enTagTMXMap3,};	CCArray		* m_pArticleArray;			//物体数组	CCArray		*m_pFrIEndarray;			//友方	CCArray		*m_pEnemyArray;				//敌方	int				m_nStageID;					//关卡ID	int				m_nRoleID;					//角色ID	CNFEnemyWave	* m_pEnemyWave;				//敌人波次public:	static CNF3DWorldLayer * CreateLayer(int nStageID,int nRoleID);	//更新函数	voID update(float delta);	//点击NPC。返回NPC的ID, 0为没有点击到NPC	int ClickNPC(CCtouch *ptouch);	//接收函数	virtual voID ReCMSg(int enMsg,voID* pData,int nSize);protected:	virtual bool InitLayer(int nStageID,int nRoleID);  	//消息处理:移除敌人	bool OnSubMsgEnemyRemove(voID *pInfo,int nSize);	//消息处理:移除主角	bool OnSubMsgProtagonistRemove(voID *pInfo,int nSize);	//消息处理:敌人普通攻击	bool OnSubMsgEnemyCommonAttack(voID *pInfo,int nSize);	//消息处理:技能	bool OnSubMsgProtagonistSkill(voID *pInfo,int nSize);	//消息处理:切换场景	bool OnSubMsgTransfer(voID *pInfo,int nSize);	//消息处理:创建敌人	bool OnSubMsgCreateEnemy(voID *pInfo,int nSize);	//消息处理:游戏胜利	bool OnSubMsgGameWin(voID *pInfo,int nSize);	voID onExit();};#endif
.cpp文件
#include "NF3DWorldLayer.h"#include "../tiledmap/NFTMXTiledMap.h"#include "../gameunit/person/NFProtagonist.h"#include "../gameunit/skill/NFCommonAttack.h"#include "../gameunit/person/NFEnemy.h"#include "../gameunit/article/NFBox.h"#include "../gameunit/article/NFNPC.h"#include "../gameunit/article/NFTransferDoor.h"#include "../datamanager/NFDataManager.h"#include "gamescene/NFGameScene.h"#include "../ui/NFTownScene.h"#define _TMX_START_X_<span >		</span>-30<span >			</span>//景深地图初始x轴坐标CNF3DWorldLayer* CNF3DWorldLayer::CreateLayer(int nStageID,int nRoleID){<span >	</span>do<span >	</span>{<span >		</span>CNF3DWorldLayer* pLayer = new CNF3DWorldLayer();<span >		</span>if (pLayer!=NulL && pLayer->InitLayer(nStageID,nRoleID)==true)<span >		</span>{<span >			</span>pLayer->autorelease();<span >			</span>return pLayer;<span >		</span>}<span >		</span>delete pLayer;<span >		</span>pLayer = NulL;<span >		</span>return NulL;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::CreateLayer Error!");<span >	</span>return NulL;}bool CNF3DWorldLayer::InitLayer(int nStageID,int nRoleID){<span >	</span>do<span >	</span>{<span >		</span>//读取关卡信息<span >		</span>TagstageStaticInfo StageInfo;<span >		</span>CNFStaticdataManager::SharedData()->GetStageStaticInfo(nStageID,StageInfo);<span >		</span>if (StageInfo.fRate < 0)<span >		</span>{<span >			</span>cclog("Fun 3D WorldLayer Create Error!");<span >			</span>return false;<span >		</span>}<span >		</span>m_nStageID = nStageID;<span >		</span>m_nRoleID = nRoleID;<span >		</span>Tagsize3D StageSize3DInfo;<span >		</span>StageSize3DInfo.fheight=StageInfo.fheight;<span >		</span>StageSize3DInfo.fLength=StageInfo.fLength;<span >		</span>StageSize3DInfo.fWIDth=StageInfo.fWIDth;<span >		</span>//初始化父类<span >		</span>CC_BREAK_IF(CNFWorld3DLayer::init(StageInfo.fRate,StageSize3DInfo)==false);<span >		</span>m_pArticleArray = CCArray::create();<span >		</span>m_pArticleArray->retain();<span >		</span>m_pFrIEndarray = CCArray::create();<span >		</span>m_pFrIEndarray->retain();<span >		</span>m_pEnemyArray = CCArray::create();<span >		</span>m_pEnemyArray->retain();<span >		</span>//CNFBox* pBox = CNFBox::CreateBox(1);<span >		</span>//pBox->SetMsg(this);<span >		</span>//pBox->setposition3D(400,400);<span >		</span>//addChild(pBox,enZOrderMID);<span >		</span>//m_pArticleArray->addobject(pBox);<span >		</span>tagposition3D ptPos3D;<span >		</span>//创建角色<span >		</span>CNFProtagonist* pProtagonist = CNFProtagonist::Create(m_nRoleID,m_pFrIEndarray,m_pEnemyArray);<span >		</span>ptPos3D.fX = StageInfo.fProtagonistX;<span >		</span>ptPos3D.fY = StageInfo.fProtagonistY;<span >		</span>ptPos3D.fZ = 0;<span >		</span>pProtagonist->SetMsg(this);<span >		</span>pProtagonist->setposition3D(ptPos3D);<span >		</span>pProtagonist->SetArticleArray(m_pArticleArray);<span >		</span>addChild(pProtagonist,enZOrderMID,enTagProtagonist);<span >		</span>m_pFrIEndarray->addobject(pProtagonist);<span >		</span>SetProtagonist(pProtagonist);<span >		</span>//创建NPC<span >		</span>for (CNFNPCJsonInfoVec::iterator it = StageInfo.NPCJsonInfoVec.begin();it != StageInfo.NPCJsonInfoVec.end();it++)<span >		</span>{<span >			</span>CNFNPC* pNPC1 = CNFNPC::Create(it->nNPCID,it->NPCStaticInfo.strArmaturename.c_str(),it->NPCStaticInfo.fLength,it->NPCStaticInfo.fWIDth,it->NPCStaticInfo.fheight);<span >			</span>pNPC1->SetMsg(this);<span >			</span>ptPos3D.fX = it->fPosX;<span >			</span>ptPos3D.fY = it->fPosY;<span >			</span>ptPos3D.fZ = it->fPosZ;<span >			</span>pNPC1->setposition3D(ptPos3D);<span >			</span>addChild(pNPC1,enZOrderMID);<span >		</span>}<span >		</span>//创建门<span >		</span>for (CNFDoorjsonInfoVec::iterator it = StageInfo.DoorjsonInfoVec.begin();it != StageInfo.DoorjsonInfoVec.end();it++)<span >		</span>{<span >			</span>CNFTransferDoor* pTransferDoor = CNFTransferDoor::Create(it->DoorStaticInfo.nRelaceStageID,pProtagonist,it->DoorStaticInfo.strArmaturename.c_str(),it->DoorStaticInfo.fLength,it->DoorStaticInfo.fWIDth,it->DoorStaticInfo.fheight);<span >			</span>pTransferDoor->SetMsg(this);<span >			</span>ptPos3D.fX = it->fPosX;<span >			</span>ptPos3D.fY = it->fPosY;<span >			</span>ptPos3D.fZ = it->fPosZ;<span >			</span>pTransferDoor->setposition3D(ptPos3D);<span >			</span>addChild(pTransferDoor,enZOrderMID);<span >		</span>}<span >		</span>//若为副本<span >		</span>if (nStageID >= _NF_TOWN_OR_BATTLE_ID_ && nStageID <_NF_TOWN_FB_ID_)<span >		</span>{<span >			</span>//创建敌人波次<span >			</span>m_pEnemyWave = CNFEnemyWave::CreateEnemyWave(nStageID,m_pEnemyArray);<span >			</span>CC_BREAK_IF(m_pEnemyWave==NulL);<span >			</span>m_pEnemyWave->SetMsg(this);// <span >			</span>CNFProtagonist* pProtagonist2 = CNFProtagonist::Create(2,m_pEnemyArray);// <span >			</span>ptPos3D.fX = 700;// <span >			</span>ptPos3D.fY = 500;// <span >			</span>ptPos3D.fZ = 0;// <span >			</span>pProtagonist2->SetMsg(this);// <span >			</span>pProtagonist2->setposition3D(ptPos3D);// <span >			</span>pProtagonist2->SetArticleArray(m_pArticleArray);// <span >			</span>pProtagonist2->SetautoMode(true);// <span >			</span>addChild(pProtagonist2,enZOrderMID);// <span >			</span>m_pFrIEndarray->addobject(pProtagonist2);//// <span >			</span>CNFProtagonist* pProtagonist3 = CNFProtagonist::Create(1,m_pEnemyArray,m_pFrIEndarray);// <span >			</span>ptPos3D.fX = 700;// <span >			</span>ptPos3D.fY = 100;// <span >			</span>ptPos3D.fZ = 0;// <span >			</span>pProtagonist3->SetMsg(this);// <span >			</span>pProtagonist3->setposition3D(ptPos3D);// <span >			</span>pProtagonist3->SetArticleArray(m_pArticleArray);// <span >			</span>pProtagonist3->SetautoMode(true);// <span >			</span>addChild(pProtagonist3,enZOrderMID);// <span >			</span>m_pEnemyArray->addobject(pProtagonist3);////<span >			</span>////<span >			</span>CNFEnemy* pEnemy = CNFEnemy::CreateEnemy(pProtagonist);//<span >			</span>pEnemy->SetMsg(this);//<span >			</span>ptPos3D.fX = 700;//<span >			</span>ptPos3D.fY = 20;//<span >			</span>ptPos3D.fZ = 0;//<span >			</span>pEnemy->setposition3D(ptPos3D);//<span >			</span>addChild(pEnemy,enZOrderMID);//<span >			</span>pEnemy->SetArticleArray(m_pArticleArray);//<span >			</span>m_pEnemyArray->addobject(pEnemy);////<span >		</span>}<span >		</span><span >		</span>//tiledmap<span >		</span>CNFMIDTMXMaP* pGameMap = CNFMIDTMXMap::CreateGameMap(StageInfo.strTMXWorldname.c_str(),this);<span >		</span>CC_BREAK_IF(pGameMap==NulL);<span >		</span>pGameMap->setposition(ccp(_TMX_START_X_,0));<span >		</span>addChild(pGameMap,-enTagMIDTMXMap,enTagMIDTMXMap);<span >		</span><span >		</span>//创建景深地图<span >		</span>int i = enTagTMXMap1;<span >		</span>for (CNFTmxStaticInfoMap::iterator it = StageInfo.TmxStaticInfoMap.begin();it != StageInfo.TmxStaticInfoMap.end();it++)<span >		</span>{<span >			</span>CMGameMapLayer* pGameMap = CMGameMapLayer::CreateGameMap(it->second.strTmxname.c_str());<span >			</span>CC_BREAK_IF(pGameMap==NulL);<span >			</span>pGameMap->setAnchorPoint(ccp(0,0));<span >			</span>pGameMap->setposition(ccp(it->second.fStartPosX,it->second.fStartPosY));<span >			</span>addChild(pGameMap,-i,i);<span >			</span>if (i==enTagTMXMap1)<span >	</span>pGameMap->SetSpeedMultipleX(0.9f);<span >			</span>if (i==enTagTMXMap2)<span >	</span>pGameMap->SetSpeedMultipleX(0.1f);<span >			</span>if (i==enTagTMXMap3)<span >	</span>pGameMap->SetSpeedMultipleX(1.0f);<span >			</span>i++;<span >		</span>}<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::init Error!");<span >	</span>return false;}voID CNF3DWorldLayer::update(float delta){<span >	</span>do<span >	</span>{<span >		</span>CCObject *pItem = NulL;<span >		</span>CCARRAY_FOREACH(getChildren(),pItem)<span >		</span>{<span >			</span>CNFBasicUnit *pNodeItem = dynamic_cast<CNFBasicUnit*>(pItem);<span >			</span>if(pNodeItem!=NulL)<span >			</span>{<span >				</span>//调整显示层级<span >				</span>int nZOrder = enZOrderMID - pNodeItem->getpositionY();<span >				</span>pNodeItem->setZOrder(nZOrder);<span >				</span>pNodeItem->CallPerFrame(delta);<span >			</span>}<span >		</span>}<span >		</span>//遍历敌人波次<span >		</span>if (m_nStageID >= _NF_TOWN_OR_BATTLE_ID_ && m_nStageID <_NF_TOWN_FB_ID_)<span >			</span>m_pEnemyWave->update();<span >		</span>//景深地图同步位置<span >		</span>for (int i=enTagTMXMap1;i<=enTagTMXMap3;i++)<span >		</span>{<span >			</span>CMGameMapLayer* pGameMap = dynamic_cast<CMGameMapLayer *>(getChildByTag(i));<span >			</span>if (pGameMap!=NulL)<span >			</span>{<span >				</span>//若存在缩放<span >				</span>if (getScale() != 1)<span >				</span>{<span >				</span>}<span >				</span>//若不存在缩放<span >				</span>else<span >				</span>{<span >					</span>pGameMap->setpositionX( getpositionX()*(pGameMap->GetSpeedMultipleX()-1) + _TMX_START_X_ );<span >					</span><span >				</span>}<span >			</span>}<span >		</span>}<span >		</span>CNFProtagonist* pProtagonist = dynamic_cast<CNFProtagonist*>(getChildByTag(enTagProtagonist));<span >		</span>if(pProtagonist==NulL){<span >			</span>SetProtagonist(NulL);<span >			</span>SendMsg(enMsgCreateGameOverLayer,NulL,sizeof(NulL));<span >			</span><span >			</span>//cclog("=========%f====%f",getpositionX(),getpositionY());<span >		</span>}<span >		</span>return;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::update Error!");}int CNF3DWorldLayer::ClickNPC( CCtouch *ptouch ){<span >	</span>CCObject *pItem = NulL;<span >	</span>CCARRAY_FOREACH(getChildren(),pItem)<span >	</span>{<span >		</span>CNFNPC *pNodeItem = dynamic_cast<CNFNPC*>(pItem);<span >		</span>if(pNodeItem!=NulL)<span >		</span>{<span >			</span>tagposition3D wzNPC = pNodeItem->GetCurrentCube()->ptPos3D;<span >			</span>Tagsize3D szNPC = pNodeItem->GetCurrentCube()->szCube;<span >			</span>CCPoint NPC2DPoint = ccp(wzNPC.fX + getpositionX() - 50,wzNPC.fY*pNodeItem->GetLTRate() + wzNPC.fZ);<span >			</span>CCRect NPC2DRect = CCRectMake(NPC2DPoint.x,NPC2DPoint.y,szNPC.fLength,szNPC.fheight);<span >			</span>if(NPC2DPoint.x>0&&NPC2DRect.containsPoint(ptouch->getLocation())){<span >				</span>//cclog("%d==================%f",pNodeItem->GetID(),wzNPC.fX);<span >				</span>CNFProtagonist* pRole = dynamic_cast<CNFProtagonist*>(getChildByTag(enTagProtagonist));<span >				</span>if(pRole!=NulL){<span >					</span>pRole->OnCtrlMovetoPonit(ccp(pNodeItem->GetCurrentCube()->ptPos3D.fX,pNodeItem->GetCurrentCube()->ptPos3D.fY));<span >				</span>}<span >			</span>}<span >			</span><span >		</span>}<span >	</span>}<span >	</span>return 0;}voID CNF3DWorldLayer::ReCMSg( int enMsg,int nSize ){<span >	</span>do<span >	</span>{<span >		</span>switch(enMsg)<span >		</span>{<span >		</span>case enMsg_Hit_Enemy:<span >			</span>{<span >				</span>//发消息,得到被击中的敌人是谁<span >				</span>SendMsg(enMsg_Hit_Enemy,pData,nSize);<span >			</span>}break;<span >		</span>case enMsg_RemoveEnemy:<span >		</span><span >			</span>{<span >				</span>SendMsg(enMsg_RemoveEnemy,0);<span >				</span>OnSubMsgEnemyRemove( pData,nSize );<span >			</span>}break;<span >		</span>case enMsg_RemoveProtagonist:<span >		</span><span >			</span>{<span >				</span>OnSubMsgProtagonistRemove( pData,nSize );<span >			</span>}break;<span >		</span>case enMsgEnemyCommonAttack:<span >		</span><span >			</span>{<span >				</span>OnSubMsgEnemyCommonAttack( pData,nSize );<span >			</span>}break;<span >		</span>case enMsgProtagonistSkill:<span >		</span>//消息处理:技能<span >			</span>{<span >				</span>OnSubMsgProtagonistSkill( pData,nSize );<span >			</span>}break;<span >		</span>case enMsgProtagonistTransfer:<span >	</span>//消息处理:传送门<span >			</span>{<span >				</span>OnSubMsgTransfer( pData,nSize );<span >			</span>}break;<span >			</span>//创建敌人<span >		</span>case enMsgCreateEnemy:<span >			</span>{<span >				</span>OnSubMsgCreateEnemy(pData,nSize);<span >			</span>}break;<span >			</span>//游戏结束<span >		</span>case enMsgGameWin:<span >			</span>{<span >				</span>OnSubMsgGameWin(pData,nSize);<span >			</span>}<span >		</span>}<span >		</span>return ;<span >	</span>} while (false);}voID CNF3DWorldLayer::onExit(){<span >	</span>m_pArticleArray->release();<span >	</span>m_pFrIEndarray->release();<span >	</span>m_pEnemyArray->release();<span >	</span>CNFWorld3DLayer::onExit();}bool CNF3DWorldLayer::OnSubMsgEnemyRemove( voID *pInfo,int nSize ){<span >	</span>do<span >	</span>{<span >		</span>//tagposition3D ptPos3D;<span >		</span>tagRemovePerson *pCmd = (tagRemovePerson*)pInfo;<span >		</span>if(pCmd->pArrayTarget!=NulL){<span >			</span>pCmd->pArrayTarget->removeObject(pCmd->pPerson);<span >		</span>}else{<span >			</span>m_pEnemyArray->removeObject(pCmd->pPerson);<span >		</span>}<span >		</span>this->removeChild(pCmd->pPerson);<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::OnSubMsgEnemyRemove Error!");<span >	</span>return false;}bool CNF3DWorldLayer::OnSubMsgProtagonistRemove( voID *pInfo,int nSize ){<span >	</span>do<span >	</span>{<span >		</span>tagRemovePerson *pCmd = (tagRemovePerson*)pInfo;<span >		</span>if(pCmd->pArrayTarget!=NulL){<span >			</span>pCmd->pArrayTarget->removeObject(pCmd->pPerson);<span >		</span>}else{<span >			</span>m_pFrIEndarray->removeObject(pCmd->pPerson);<span >		</span>}<span >		</span><span >		</span>this->removeChild(pCmd->pPerson);<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::OnSubMsgProtagonistRemove Error!");<span >	</span>return false;}bool CNF3DWorldLayer::OnSubMsgEnemyCommonAttack( voID *pInfo,int nSize ){<span >	</span>do<span >	</span>{<span >		</span>//return true;<span >		</span>tagposition3D ptPos3D;<span >		</span>tagCommonAttack *pCmd = (tagCommonAttack*)pInfo;<span >		</span>CNFCommonAttack* pAttack = CNFCommonAttack::CreateCommonAttack(pCmd,m_pFrIEndarray);<span >		</span>if(pAttack!=NulL){<span >			</span>ptPos3D.fX = pCmd->pReleaser->GetCurrentCube()->ptPos3D.fX + pCmd->foldX;<span >			</span>ptPos3D.fY = pCmd->pReleaser->GetCurrentCube()->ptPos3D.fY + pCmd->foldY;<span >			</span>ptPos3D.fZ = pCmd->pReleaser->GetCurrentCube()->ptPos3D.fZ + pCmd->foldZ;<span >			</span>pAttack->setposition3D(ptPos3D);<span >			</span>pAttack->SetGround(pCmd->pReleaser->GetGround());<span >			</span>pAttack->SetMsg(this);<span >			</span>this->addChild(pAttack,pCmd->pReleaser->getZOrder());<span >		</span>}<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::OnSubMsgEnemyCommonAttack Error!");<span >	</span>return false;}bool CNF3DWorldLayer::OnSubMsgProtagonistSkill( voID *pInfo,pCmd->pArrayTarget);<span >		</span>if(pAttack!=NulL){<span >			</span>ptPos3D.fX = pCmd->pReleaser->GetCurrentCube()->ptPos3D.fX + pCmd->foldX;<span >			</span>ptPos3D.fY = pCmd->pReleaser->GetCurrentCube()->ptPos3D.fY + pCmd->foldY;<span >			</span>ptPos3D.fZ = pCmd->pReleaser->GetCurrentCube()->ptPos3D.fZ + pCmd->foldZ;<span >			</span>pAttack->setposition3D(ptPos3D);<span >			</span>pAttack->SetGround(pCmd->pReleaser->GetGround());<span >			</span>pAttack->SetMsg(this);<span >			</span>this->addChild(pAttack,pCmd->pReleaser->getZOrder());<span >		</span>}<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::OnSubMsgProtagonistSkill Error!");<span >	</span>return false;}bool CNF3DWorldLayer::OnSubMsgTransfer( voID *pInfo,int nSize ){<span >	</span>do<span >	</span>{<span >		</span>tagTransferDoor *pCmd = (tagTransferDoor*)pInfo;<span >		</span>CC_BREAK_IF(pCmd->nID<=0);<span >		</span>if(pCmd->nID>_NF_TOWN_OR_BATTLE_ID_ && pCmd->nID <_NF_TOWN_FB_ID_){<span >			</span>//跳转到副本<span >			</span>CCScene * pScene = CNFGameScene::CreateGameScene(pCmd->nID,m_nRoleID);<span >			</span>CC_BREAK_IF(pScene==NulL);<span >			</span>CCDirector::sharedDirector()->replaceScene(/*CCTransitionFade::create(1.f,pScene)*/pScene);<span >		</span>}else if(pCmd->nID>0 && pCmd->nID <_NF_TOWN_OR_BATTLE_ID_)<span >		</span>{<span >			</span>//跳转到城镇<span >			</span>CCScene * pScene = CNFTownScene::CreatetownScene(pCmd->nID,pScene)*/pScene);<span >		</span>}<span >		</span>else<span >		</span>{<span >			</span>SendMsg(enMsgCreateFbSelectLayer,&pCmd->nID,sizeof(pCmd->nID));<span >		</span>}<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::OnSubMsgTransferSkill Error!");<span >	</span>return false;}//消息处理:创建敌人bool CNF3DWorldLayer::OnSubMsgCreateEnemy( voID *pInfo,int nSize ){<span >	</span>do<span >	</span>{<span >		</span>Cmd_CreateEnemyInfo *pCmd = (Cmd_CreateEnemyInfo *)pInfo;<span >		</span>CNFProtagonist* pProtagonist = dynamic_cast<CNFProtagonist*>(getChildByTag(enTagProtagonist));<span >		</span>if(pProtagonist!=NulL){<span >			</span>CNFEnemy* pEnemy = CNFEnemy::CreateEnemy(pCmd->nEnemyID,pCmd->nEnemyLevel,m_pFrIEndarray);<span >			</span>CC_BREAK_IF(pEnemy==NulL);<span >			</span>pEnemy->SetMsg(this);<span >			</span>int nTempL = Get3DWorldSize()->fLength;<span >			</span>int nTempW = Get3DWorldSize()->fWIDth;<span >			</span>tagposition3D ptPos3D;<span >			</span>ptPos3D.fX = pCmd->fPosX;<span >			</span>ptPos3D.fY = pCmd->fPosY;<span >			</span>ptPos3D.fZ = 0;<span >			</span>pEnemy->setposition3D(ptPos3D);<span >			</span>pEnemy->SetArticleArray(m_pArticleArray);<span >			</span>addChild(pEnemy,enZOrderMID);<span >			</span>m_pEnemyArray->addobject(pEnemy);<span >		</span>}<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::OnSubMsgCreateEnemy Error!");<span >	</span>return false;}//消息处理:游戏结束bool CNF3DWorldLayer::OnSubMsgGameWin( voID *pInfo,int nSize ){<span >	</span>do<span >	</span>{<span >		</span>SendMsg(enMsgCreateGameWinLayer,sizeof(NulL));<span >		</span>return true;<span >	</span>} while (false);<span >	</span>cclog("Fun CNF3DWorldLayer::OnSubMsgGameWin Error!");<span >	</span>return false;}个人博客 www.sundaboke.com
总结

以上是内存溢出为你收集整理的分析Cocos2d-x横版ACT手游源代码 5、3D世界全部内容,希望文章能够帮你解决分析Cocos2d-x横版ACT手游源代码 5、3D世界所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1016786.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存