上一篇博文提到,程序如何获取键盘输入,也就是D键按下,程序获取到前进指令,那么获取到前进指令之后,马里奥是如何前进的呢,这篇文章我们重点讨论这个问题。

马里奥的移动,依旧是在帧刷新函数中,这个调用过程上个博文说过,这里不再重复,简单来说就是CMGameScene::OnCallPerFrame调用CMGameMap::OnCallPerFrame,再调用CMGameMap::MarioMove函数,在MarioMove函数中,实现马里奥的移动。

void CMGameMap::MarioMove(float fT)
{
do
{
CMMario* pMario = dynamic_cast<CMMario*>(getChildByTag(enTagMario));
CC_BREAK_IF(pMario==NULL);
CCPoint CurMarioPos = pMario->getPosition(); //如果左键按下
if(m_bIsLeftKeyDown)
{
pMario->OnCtrlMove(fT,false);
}
//如果右键按下
if (m_bIsRightKeyDown)
{
CCPoint CurMarioPos = pMario->getPosition();
pMario->OnCtrlMove(fT,true);
//如果Mario的位置变化了,则地图才会卷动
if (convertToWorldSpace(pMario->getPosition()).x>120 && abs(pMario->getPositionX()-CurMarioPos.x)>1 &&
pMario->getPositionX() < (getContentSize().width - SCREEN_WIDTH + 100))
{
setPositionX(getPositionX()-100*fT);
}
}
//如果跳跃键按下
if (m_bIsJumpKeyDown)
{
pMario->OnCtrlJump();
}
//如果没有键按下
if (m_bIsLeftKeyDown==false && m_bIsRightKeyDown==false && m_bIsJumpKeyDown==false)
{
pMario->OnCtrlNoAction();
}

在MarioMove函数中,根据按键的情况,分别调用Mario对象的OnCtrlMove,OnCtrlJump,OnCtrlNoAction三个函数

我们依次来学习这么三个函数,这个文章里首先学习平移函数OnCtrlMove函数

void CMMario::OnCtrlMove(float fT,bool bToRight)
{
if(m_pGameMap==NULL)
{
CCAssert(false,"Error:No Map!");
return;
}
//判断是否可以移动
bool bCanMove = true;
CCSprite* pTileSpriteTop = NULL;
CCSprite* pTileSpriteMid = NULL;
CCSprite* pTileSpriteBottom = NULL; CCPoint ptPosTop = bToRight?ccp(getPositionX()+boundingBox().size.width,getPositionY()+boundingBox().size.height):
ccp(getPositionX(),getPositionY()+boundingBox().size.height);
CCPoint ptPosMid = bToRight?ccp(getPositionX()+boundingBox().size.width,getPositionY()+boundingBox().size.height/2):
ccp(getPositionX(),getPositionY()+boundingBox().size.height/2);
CCPoint ptPosBottom = bToRight?ccp(getPositionX()+boundingBox().size.width,getPositionY()+5):
ccp(getPositionX(),getPositionY()+5); //检查马里奥前进方向是否有障碍(检查 上 中 下 三个方向)
pTileSpriteTop = m_pGameMap->TileMapLayerPosToTileSprite(ptPosTop);
pTileSpriteMid = m_pGameMap->TileMapLayerPosToTileSprite(ptPosMid);
pTileSpriteBottom = m_pGameMap->TileMapLayerPosToTileSprite(ptPosBottom); if (pTileSpriteTop!=NULL || pTileSpriteMid!=NULL || pTileSpriteBottom!=NULL)
{
bCanMove = false;//若在前进方向找到了砖块 则 禁止移动
}
//判断马里奥是否移动出屏幕边界
if(bToRight==false)//判断是否左出界
{
CCPoint ptMarioInWorld = m_pGameMap->convertToWorldSpace(getPosition());
if(ptMarioInWorld.x<=0)
{
bCanMove = false;
}
}
else//判断是否右出界(假定,实际不应该出现这种情况)
{
CCPoint ptMarioInWorld = m_pGameMap->convertToWorldSpace(getPosition());
if(ptMarioInWorld.x>=SCREEN_WIDTH-boundingBox().size.width)
{
bCanMove = false;
}
} //根据马里奥当前状态 来处理
switch(m_eCurMarioStatus)
{
case enMarioStatusStandLeft: //如果是待机状态
case enMarioStatusStandRight:
{
//根据状态播放动画
switch(m_eCurMarioLevel)
{
case enMarioLevelSmall:
{
m_pCcbReader->getAnimationManager()->runAnimationsForSequenceNamed(_CCB_MARIO_SMALL_RUN_);
}break;
case enMarioLevelBig:
{
m_pCcbReader->getAnimationManager()->runAnimationsForSequenceNamed(_CCB_MARIO_BIG_RUN_);
}break;
case enMarioLevelMax:
{
m_pCcbReader->getAnimationManager()->runAnimationsForSequenceNamed(_CCB_MARIO_MAX_RUN_);
}break;
} //变更位移
if(bCanMove==true)
{
float fCurPosX = getPositionX();
if(bToRight)
{
fCurPosX += _MARIO_BASIC_SPEED_PER_SEC_*fT; //向右移动
m_bFaceToRight = true;
}
else
{
fCurPosX -= _MARIO_BASIC_SPEED_PER_SEC_*fT; //向左移动
m_bFaceToRight = false;
}
setPositionX(fCurPosX);
} //改变马里奥状态
m_eCurMarioStatus = bToRight?enMarioStatusRunRight:enMarioStatusRunLeft; //设置马里奥面对方向
MarioTurn(bToRight); }break;
case enMarioStatusRunLeft: //若马里奥正在向左移动
case enMarioStatusRunRight: //这里设计成允许直接变向,如果要增加额外动作效果,可在这里区分
{
//变更位移
if(bCanMove==true)
{
float fCurPosX = getPositionX();
if(bToRight)
{
fCurPosX += _MARIO_BASIC_SPEED_PER_SEC_*fT; //向右移动
}
else
{
fCurPosX -= _MARIO_BASIC_SPEED_PER_SEC_*fT; //向左移动
}
setPositionX(fCurPosX);
}
//改变马里奥状态
m_eCurMarioStatus = bToRight?enMarioStatusRunRight:enMarioStatusRunLeft; //设置马里奥面对方向
MarioTurn(bToRight);
}break;
case enMarioStatusOnAirLeft: //同方向跳跃正常位移 反方向跳跃 不改变面对方向 且位移量减半
case enMarioStatusOnAirRight: //
{
if(bCanMove==true)
{
//变更位移
float fCurPosX = getPositionX(); //计算位移量
float fMoveDis = 0.f;
if((m_eCurMarioStatus==enMarioStatusOnAirLeft&&bToRight==true)||(m_eCurMarioStatus==enMarioStatusOnAirRight&&bToRight==false))
{
fMoveDis = _MARIO_BASIC_SPEED_PER_SEC_*fT*0.5f; //若反向 则 位移量减半
}
else
{
fMoveDis = _MARIO_BASIC_SPEED_PER_SEC_*fT; //若同向 则 正常位移
} if(bToRight)
{
fCurPosX += fMoveDis; //向右移动
}
else
{
fCurPosX -= fMoveDis; //向左移动
}
setPositionX(fCurPosX);
}
}break;
}
}

这个函数代码比较多,我们一段段来分析,首先第一段代码

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA38AAAFhCAIAAABPloQaAAAgAElEQVR4nO29XbaksK5mG/2pTp4u3Eac52oi9yH3pli2JEvyDwbmHDlyEApbkoWxvyQyiN+x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bSx1RG0szTxRnwAAsXXQ0JSoz5PQLcmQcYj6nHrv05CSxktRsNppOtWneEfQaBwK4VGfUZ92JtFRGBmG5LvxliaIizRCOk+L7hm+nbyhWaPq0+ir/RMllDMAwIsJr4Pid4n8RidPV5/ivUPbKN50LCzn33WDOgctq3HDbHzr6Hyrtni6GyOKKqdDuQ1mewhplMSdOc1JSGMZqtfQf8ffgtiB7LGIyjiRsEGzzonuHtXuiShOJNGzf0oAALyeTZfCR6tPmEG/+nRaRJ1aq5bCaGgXj7fc0DRNqTW+5uPx1kzAIDoQvx+t7M3u2mnSzpEh0I0y2gk02wMAfIFNV0PUJwAAAMArQX0CAAAAwDpQnwAAAACwDtQnAAAAAKwD9QkAAAAA6/i6+hz7ECIAAAAAsBnzvM9DeaR8+pGfK+99oj4BAAAAlhETXtovGNl6FPUJAAAAAP/ICy//L20mQH0CAAAAvJKM8PJ88v7v5SN+aRP1CQAAALCMifc+n/LJ+4EABQAAAFjFik/eN1efSE8AAACAZaA+UZ8AAAAA6xjznXf7JeoTAAAAAP4x5nmffqMT1CcAAADAK9lUePFbRwAAAACvZFPhxe+8AwAAALwS1CcAAAAArAP1CQAAAADr+P8BpDJM4F/nAzUAAAAASUVORK5CYII=" alt="" />

这段代码根据马里奥移动的方向,找到它移动的边界点ptPosTop,ptPosButton, ptPosMid,再查看这三个点上是否有障碍物,如果有,那么马里奥不能移动。

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAngAAAERCAIAAABn5k1iAAAc2ElEQVR4nO3dXZLiOhaFUc+nJ3mn0IO4zz1E90NWEU7rnK2tP2PMtyKjghSyJAunNqYAb/tb/fvvv+8dAAAAS23v7Z6gBQA8G0Eb2/4JZsYs3P7ZXoU/t8ufkWFU78q6NjsNGz/tVHc7Tff6s6fHFu5OU6dinACgfWPQirW4XK+PlcPbZaZ2D8BZ5TuyJ+tU9PhqszqGamHrPFTvrT6JcUbiNG6OEwC0dAX5z3//9/NTlofVwspV1wdtNZOOiXtadsNq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AyPA52gkIWgBAhm+GmoBvhgIAZAhaAAAWImgBAFiIoAUAYCGCFgCAhQhaAAAWImgBAFhowudo966vqvhB0B6JjwltBx1t/mzV18I62/bnZ7AOANzZ6DdD7clFfkwE7UmYgsfCjpg8Be3I8CZ6DcQZ0W1GDQDNRr/rWNRxELQnZRCOR+PNg3Z6ZQC4ldHr0b4K+7onaE/Kl4hFNJY1w0DV5afNwxeZndect0Je89dPeFe5iWjE2JygBvA2nNHeS/kqsfhf2/J2mNDHdsL87igcp9O0DOBqTbE5ALwRQXsvftC+6mSnvxOD1jlPbZW1lJ3phtXCDXnzFIBbIWjvpSlos5PXsNAJ2rBTM1z9l47/1leF1aAtywlXAPc04V3H5a8+gvZk8BXd1UHLS8cA0CpdkLge7VtkZ4S6MDyVPJW8/i0rlGPIRjVvNytvhnrdFb4gXN28ukcAcJk3L0AELS5A0AJ4I4IWAICFCFoAABYiaAEAWIigBQBgIYIWAICFCNp+cz/xAgB4JD5HO4SgBQBoo98MJb4uykHQAgCebfS7jgnadw8BAHBrKif869G+7mrtnqAFADzbnKv3ZNWqPj1od7IWACBxmbwhpCwAQJsQtN0puxO0AICnm/mu4w4ELQDg2UY/R/sq6fsoLUELAHg2vhmqH98MBQCoImgBAFiIoAUAYCGCFgCAhQhaAAAWImgBAFjoW4KWdwgDAN7ii65HS9ACAK73RdejJWgBANebdvWerFAjaAEAzzbnerS8dAwAQOiLzmh3shYAcLkvClpSFgBwPYIWAICFeNcxAAAL8TlaAAAW4puhAABY6FuCFgCAtyBoAQBYiKAFAGCh/wO2hPlEyEASGAAAAABJRU5ErkJggg==" alt="" />

以上代码判断马里奥是否出了边界,判断出边界有很多办法,这里采用了转化成世界坐标来判断的方法。

这里要注意的是这段代码:

CCPoint ptMarioInWorld = m_pGameMap->convertToWorldSpace(getPosition());

首先getPosition是马里奥精灵调用的函数,它返回的坐标是它的父亲节点的坐标系,也就是地图的坐标系。

然后用m_pGameMap去调用convertToWorldSpace,又把这个坐标转化成窗口的坐标。

这个窗口的坐标,如何x<0或者x>窗口的宽度,那么我们认为出界了。

如果大家不怎么理解上面的话,那么建议好好学习cocos2dx的坐标系,在之前的博文中有。

接下来就是马里奥的移动,如果能移动的话,根据马里奥原来的状态,来控制马里奥的移动,这里选取一种case来说明,因为其他case是差不多的。

马里奥的状态有:向左站立,向右站立,向左移动,向右移动,向左飞行,向右飞行六种状态,我们看看在移动状态下的case是如何处理的

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAArMAAAFsCAIAAABQBaYrAAAgAElEQVR4nO3dWZajsJaFYeZTk8wp1CDucw2ReogbQEin2Wro7P9buXI5ZCEJbKNtsPGyPsZ//vOfu4cAnG75txQ3invNf62NN911Xmuzqh03wpStASDwoFcOyQCv5s30qz/fi3N/U4YoKo/UCQZWtyAOu6m1dLRpoTgAAEfSK+d//vf/fv71FYq+Nhksv4rbHe00ddfXS7flr+7FT12kmz41Ku99W+fdoE2xmtKdGG7G6wQTfNPETzIA+uSvnOM0v93WC3VfmwzW3znseOO8jtLbeguzej+j663yYKdqd3ckA+Ut/nbQYlsk7jq9d2TxvkMLxRYTV0E58gHA1PaCIRmc5JZkoJSP1IyXvSwZdLfQ0FfjhJdO/HOPGegBIh25UnNiMlCOItTV6q1BMgCaqC8Y88TB6ieAhyeDZdn/1YV9NZ2O/hzQ9hJAXJ7WrKsF5fWfR+ngvTUKBm+2ECwebI3Voo8zWE2zZZEyc+sHz70G4/a9BUeqxZ16Nc1TBkq/TZ0qTZEMgD6dxwzW8CMFD/+cQTHHTyl0OjJmtWK6Ot44/u8tXrTgdRcsbrZQNxj0rtQMCpVxBlupe5xB4UgymPK+ua6jpIeJZxOCHFOUe73XTSnv3dO1MLOFciAh7hdAoDMZBCcO+mLBelMyqO8yDw+YddLDBub71HTKNGfxdM4zF4wXEdtMe9cTjBJ6xMJ6hMpWGkkAnqZkoMzlTR2ld4l10mMGZqRIjxl4N5Q/t8KiazGFBP0CiE1OBt2xYH1AMjCPCtQl+uSiz8deMk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7jd0Y7eV3cvygC8xsXe42rpsFtXjXAA4Gu1Xeno+Gd9m19hnqtIBqd2VPw/vfH6dkfvaVP6SNJykgGAryXt/n6meX6F+WKXJYOtu7PbjA8JNLV2djLo6wIAPkC+72v9FWbOJsziJYP6iLpZMzjwnh6Qr9vxOorjS50M9NMB3mqmW8OrHGwicUheIQB8kvnJICiMkQwK20y2HiakYlI83lZmMm9xvWbdUT37ntR7sSmUxYO44y2blgPAZ0v2fd2/vEwyGGcmg+2u+q1z0Ij5Z3cyCLq4IBmkY/Bq6msUlwPAZ5OOGZg/q2jejgtjJIOClwxG3vh+STJYnWMbykjScgD4bA37Pr6bcLHWswlBI8oiZyQDvZ2mZNC0eOtIgkIA+Abq7s88bMD1DM6zveXd/j9OkEdFSdFCUF535xUGHZl/Fo2YDeq9xx2Zq9k6znjYSjkAfIwH7eZIBp/q+tl0yQ4J6IvrdwHAZ3jQbo5kgInM4xAAgNSD9pskAwAAbkcyAAAAO5IBAADYkQwAAMCOZDAHH3YDAHyGzisdreGlC77zegbVF+LX6VHhjDYBADhqu9LR8U/zdl1T92HJYF1PmcVJBgCAU0nzzM9Mr/+6Esngt+SMXua3CQDARvpFpeKGd9usqfvIZLD9KwrX6tRAXdMsPC5bVSY1AABGkQxmqj9q4N2uE0B9Oy4kBgAAzpBML31nEL4zGcRnE7zbW4l5gGGtDg9sxwwAADiDdMzA/KHF+rZZU/flycBp07jBNxQAAOfp/NZifISAZPBbkt8O7uVsAgDgem3fWiwCgXl4oPuwwUcmA+8TiMqHDdfqLMOxDp9ABACc4UFzyauTwROugXj7AAAAH+D/AV9C77oQpA+oAAAAAElFTkSuQmCC" alt="" />

在这个case中,如果能移动,则根据ft时间计算移动长度,再累加到马里奥的x坐标,最后设置新的位置,这样完成了位置的移动

如果方向发生变化,那么马里奥的状态也要变,同时马里奥的方向也要变,这个是调用MarioTurn函数实现的。

cocos2d-x游戏开发系列教程-超级玛丽07-CMGameMap(四)-马里奥平移的更多相关文章

  1. cocos2d-x游戏开发系列教程-超级玛丽10-怪物与马里奥冲突检测

    在超级玛丽游戏中,马里奥在移动,怪物也在移动,当他们遇见时,需要判断是马里奥身亡还是怪物身亡. 这个判断的代码在怪物类的检测函数实现中. 比如蘑菇怪的冲突检测函数: bool CMMonsterMus ...

  2. cocos2d-x游戏开发系列教程-超级玛丽07-CMGameMap(三)-按键处理

    在地图初始化好了之后,就开始移动马里奥吧,我在windows下,是使用键盘来移动马里奥的 w是跳,d是前进,a是后退,那么在程序里是怎么来获取这个按键的呢? 普通的windows程序,在按键之后,会有 ...

  3. cocos2d-x游戏开发系列教程-超级玛丽01-前言

    前言 上次用象棋演示了cocos2dx的基本用法,但是对cocos2dx并没有作深入的讨论,这次以超级马里奥的源代码为线索,我们一起来学习超级马里奥的实现,并以一些篇幅来详细讲述遇到的具体问题和具体的 ...

  4. cocos2d-x游戏开发系列教程-超级玛丽07-CMGameMap

    背景 在上一篇博客中,我们提到CMGameScene,但是CMGameScene只是个框架,实际担任游戏逻辑的是CMGameMap类,这个博文就来了解下CMGameMap 头文件 class CMGa ...

  5. cocos2d-x游戏开发系列教程-超级玛丽06-CMGameScene

    背景 在CMMenuScene中,当用户点击开始游戏时,导演让场景进入到CMGameScene 头文件 class CMGameScene : public cocos2d::CCLayer,publ ...

  6. cocos2d-x游戏开发系列教程-超级玛丽08-消息机制

    在超级玛丽游戏里,地图类CMGameMap负责所有的程序逻辑,它包含了背景地图,包含了游戏元素精灵,当游戏中的精灵之间发生碰撞时,比如马里奥撞上砖头这种事情发生时,马里奥对象本身不知道怎么处理这个逻辑 ...

  7. cocos2d-x游戏开发系列教程-超级玛丽05-CMMenuScene

    代码下载链接 http://download.csdn.net/detail/yincheng01/6864893 解压密码:c.itcast.cn 背景 上一篇博文提到appDelegate,在该类 ...

  8. cocos2d-x游戏开发系列教程-超级玛丽09-怪物激活与移动

    在游戏中,很多怪物本身是会移动的,这里主要有蘑菇怪,乌龟等. 说起怪物的移动,首先在游戏里先要考虑怪物的抽象和设计. 在CMMonster.h中,有个类CMMonsterBasic,这个类抽象了所有的 ...

  9. cocos2d-x游戏开发系列教程-超级玛丽07-CMGameMap(五)-地图卷动

    马里奥在平移的过程中,涉及到地图的卷动问题. 在这个游戏里,地图比窗口大,窗口只是显示了地图的一部分,因此马里奥在移动的时候,移动到一定位置之后要卷动地图,否则马里奥移动到窗口右边之后......那结 ...

  10. cocos2d-x游戏开发系列教程-超级玛丽04-AppDelegate

    代码下载链接 http://download.csdn.net/detail/yincheng01/6864893 解压密码:c.itcast.cn 背景 上一篇博文提到在CCApplication: ...

随机推荐

  1. Spring 构造注入 传參数

    1.        提供相应的构造方法 //构造器注入 public class Bean6 { private String name; private Integer age; // 服务于构造器 ...

  2. Css Rest 方法

    在当今网页设计/开发实践中,使用CSS来为语义化的(X)HTML标记添加样式风格是 重要的关键.在设计师们的梦想中都存在着这样的一个完美世界:所有的浏览器都能够理解和适用多有CSS规则,并且呈现相同的 ...

  3. Insert into a Cyclic Sorted List

    Given a node from a cyclic linked list which has been sorted, write a function to insert a value int ...

  4. python的filter()函数

    filter()函数是 Python 内置的另一个有用的高阶函数. filter()函数接收一个函数 f 和一个list,这个函数 f 的作用是对每个元素进行判断,返回 True或 False,fil ...

  5. java ajax初始化

    <script type="text/javascript">    var http_request = false;    function createXMLHt ...

  6. struts2 taglib struts标签学习整理中

    项目中经常会用到struts标签,这样可以减少代码量. select用法: <s:select list="#request.sysTypes" name="rul ...

  7. access数据库 top语句失效解决方法

    使用查询语句  select   top 1  *  from  News  order  by  [PublicTime] desc   就不一定管用了,如果News表里面的PublicTime字段 ...

  8. 转: Transact-sql游标使用详解~~很详细

    /*原理:游标就是把数据按照指定要求提取出相应的数据集,然后逐条进行数据处理.1.1游标的概念 游标(Cursor)它使用户可逐行访问由SQL Server返回的结果集. 使用游标(cursor)的一 ...

  9. Understanding and Selecting a SIEM/LM: Correlation and Alerting

    Continuing our discussion of core SIEM and Log Management technology, we now move into event correla ...

  10. Windows下配置PHP

    啥也不说了,照着这两篇做,OK 1. windows下apache+php+mysql 环境配置方法 详细出处参考:http://www.jb51.net/article/30128.htm 2.ht ...