标签:erp cto size title 世界 为知笔记 round enter ntb
void MPlayer::setMapPointByMplayer()
{
Size visableSize = Director::getInstance()->getVisibleSize();
Size mapTileNum = getGameMap()->getMapSize();
Size tiledSize = getGameMap()->getTileSize();
//世界大小 2.x CCSizeMake
Size mapSize = Size(mapTileNum.width * tiledSize.width, mapTileNum.height * tiledSize.height);
Point mplayerPoint = mSprite->getPosition();
float x = mplayerPoint.x > visableSize.width / 4 ? mplayerPoint.x : visableSize.width / 4;
x = x < mapSize.width - visableSize.width*.8 ? x : mapSize.width - visableSize.width*.8;
float j = mapSize.width - visableSize.width*0.8;
float y = mplayerPoint.y > visableSize.height / 4 ? mplayerPoint.y : visableSize.height / 4;
y = y < mapSize.height / 2 ? y : mapSize.height / 2;
Point desPoint = ccp(x, y);//目标点
Point centerPoint = ccp(visableSize.width / 5, visableSize.height / 4);
Point ritPoint = ccpSub(centerPoint, desPoint);
getGameMap()->setPosition(ritPoint);
}
标签:erp cto size title 世界 为知笔记 round enter ntb
原文地址:http://www.cnblogs.com/feizuzu/p/859bf3bd096bd123c891047da4f79da9.html