首页 > 其他 > 详细

bug 复制代码没有审查,没有完全就该变量名

时间:2015-02-23 21:10:17      阅读:271      评论:0      收藏:0      [点我收藏+]
bool HeroSprite::isLeftWall(Point nextPos)
{
    auto mapLayer=_map->getLayer("Map");
    CCASSERT(mapLayer!=nullptr,"map is error ---HeroSprite::isGround");
    
    auto heroSize=getSpriteFrame()->getRect().size;

    auto leftPos=Point(nextPos.x-heroSize.width/2,nextPos.y);
    int x=posToCoordinate(leftPos).x;
    int y=posToCoordinate(leftPos).y;

    auto gid=mapLayer->getTileGIDAt(Point(x,y));
    
    if (gid==1||gid==2||gid==3||
        gid==4||gid==5||gid==6||
        gid==21||gid==22||gid==23||
        gid==24||
        gid==25||gid==26||gid==27)
    {
        return true;
    }

    
    auto leftFootPos=Point(nextPos.x-heroSize.width/2,nextPos.y-heroSize.height/2);
    int footx=posToCoordinate(leftFootPos).x;
    int footy=posToCoordinate(leftFootPos).y;

    auto footgid=mapLayer->getTileGIDAt(Point(footx,footy));

    if (footgid==1||footgid==2||footgid==3||
        footgid==4||footgid==5||footgid==6||
        footgid==21||footgid==22||footgid==23||
        footgid==24||
        footgid==25||footgid==26||footgid==27)
    {
        return true;
    }
    
    return false;

}

 

bug 复制代码没有审查,没有完全就该变量名

原文:http://www.cnblogs.com/yufenghou/p/4298237.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!