当前位置: 首页 > news >正文

装甲逆袭-NPC移动处理

处理NPC的移动,目前采取的方式是预设一段移动方式,然后在地图中编辑,然后NPC读取之后通过该方式移动。


#include "MoveNPCSprite.h"


bool MoveNPCSprite::init()

bool bRet = false;
do 
{
CC_BREAK_IF(! CommonNPCSprite::init());


runRoute[0][0]=0;
runRoute[0][1]=1;
runRoute[0][2]=2;
runRoute[0][3]=3;
runRoute[0][4]=-1;


moveflag=1;
moveindex=0;
movelength=0;
moveSpeed=1;
isShowDialogTip=false;
bRet = true;
} while (0);


return bRet;
}




void MoveNPCSprite::setValueInfo(npcinfo_struct npcinfo){
this->npcinfo=npcinfo;
this->setTag(this->npcinfo.npcTag);


}


void MoveNPCSprite::showDialogTip(){
if (!isShowDialogTip)
{
dialogTip=CCSprite::create("rpggame/other/showdialog.png");
dialogTip->setTag(1985);
dialogTip->setPosition(ccp(80,80));
this->addChild(dialogTip);
isShowDialogTip=true;
}

}


void MoveNPCSprite::notShowDialogTip(){
if (isShowDialogTip)
{
this->removeChildByTag(1985,true);
isShowDialogTip=false;
}
}




void MoveNPCSprite::moveByMoveKind(){
moveSprite(runRoute[npcinfo.npcmovekind][moveindex]);
movelength=movelength+moveSpeed;
if (movelength==npcinfo.npcmovelength)
{
moveindex=moveindex+moveflag;
movelength=0;
if (runRoute[npcinfo.npcmovekind][moveindex]==-1)
{
moveindex=moveindex-1;
moveflag=-1;
}else if (moveindex==-1)
{
moveindex=moveindex+1;
moveflag=1;
}

}
}


int MoveNPCSprite::getNowRunDirection(){
return runRoute[npcinfo.npcmovekind][moveindex];
}


http://www.taodudu.cc/news/show-6105775.html

相关文章:

  • 装甲逆袭-玩家碰撞处理
  • 他一个人干掉了5个装甲军
  • 装甲逆袭-加载NPC
  • robomaster(1)装甲板识别
  • 装甲逆袭-资源加载
  • 视觉组考核——装甲板识别
  • 装甲逆袭-玩家移动处理
  • 开机后我的计算机打不开,电脑开机后图标打不开怎么办
  • 电脑开不了机的原因和解决办法
  • Proe转Solidworks
  • proe5.0插件在windows7 64系统预览模型
  • proe常用c语言语句,proe关系式(大全).doc
  • proe5.0启动失败,光标转了几圈后没有任何反应
  • proe常用c语言语句,Proe如何使用if条件语句?
  • proe常用c语言语句,带你轻松搞懂Proe条件语句
  • 【MFC】基于OpenCV的魔镜
  • 魔镜魔镜告诉我谁是世界上最美的人 语音唤醒,百度语音识别。从装系统开始
  • 制作魔镜页
  • 魔镜连接本地mysql_打造属于你的树莓派“魔镜”—硬件篇
  • 旧电脑利用:windows网页版魔镜【不需树莓派】
  • 笔记1 第11课 贪心初步 ——柠檬水找零,分发饼干,跳跃游戏,完成所有任务所需最小能量——极客时间算法
  • 学完教程,不知道接下去从哪里开始做自己的第一个APP,怎么办?酷课堂iOS交流群问答(201902期)
  • 贪心相关:柠檬水找零、买卖股票的最佳时机、分发饼干、跳跃游戏 ...
  • 干货来了 | SQL 进阶技巧
  • 干货 | SQL 进阶技巧
  • 【LeetCode】两道贪心算法题目-455分发饼干,860柠檬水找零
  • LeetCode455分发饼干
  • 柠檬模拟群面复盘
  • 7-7 快速求和
  • 1.神奇的字符串之快速求和