码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-02-23 21:12:14      阅读:251      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!