装甲逆袭-NPC移动处理
来源:互联网 发布:java生产管理系统 编辑:程序博客网 时间:2024/04/27 20:17
处理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];
}
- 装甲逆袭-NPC移动处理
- 装甲逆袭-NPC对话处理
- 装甲逆袭-加载NPC
- 装甲逆袭-玩家移动处理
- 装甲逆袭-玩家碰撞处理
- 装甲逆袭-开发进度
- 装甲逆袭-资源加载
- 装甲逆袭-地图加载
- 装甲逆袭-人物属性界面
- 装甲逆袭-药品店界面
- 装甲逆袭-剧情
- 装甲逆袭-获取坦克界面
- 装甲逆袭-装备店界面
- 装甲逆袭-自动寻路
- 装甲逆袭-回合战斗小怪战斗界面
- NPC简单AI处理
- NPC简单AI处理
- npc
- Selenium_Selenium for Android: MonkeyTalk Installation and Use
- 使用Hibernate 操作原生sql语句建表
- POJ 3080 查找公共最长子串 kmp+枚举
- Java学习笔记——子类调用父类属性方法
- 如何自己手动创建一个GNI的库
- 装甲逆袭-NPC移动处理
- Struts2输入检验(一)使用Annotation验证
- 1010. Radix (25)
- Cache, L2 Cache, CacheRangeFlush
- HTML前进后退功能
- 第二周项目二 读取数据到结构体数组
- c语言全局变量和局部变量问题汇总
- 使用Netbeans 6.7打包第三方jar
- Hash Functions