void MPlayer::setMapPointByMplayer()
{
Size visableSize = Director::getInstance()->getVisibleSize();
Size mapTileNum = getGameMap()->getMapSize();
Size tiledSize = getGameMap()->getTileSize();
//世界大小 2.x CCSizeMake
size = size ( maptilenum width * Tiledsize width Maptilenum height * Tiledsize height
point = Msprite -> Span class= "PLN" >getposition ();
float = Mplayerpoint x > Visablesize width / 4 Mplayerpoint x : Visablesize width / 4 ;
x = x < mapsize width - Visablesize width *. 8 x : Mapsize width - Visablesize width *. 8
float = mapsize width - Visablesize width * 0.8
float = Mplayerpoint y > Visablesize height / 4 Mplayerpoint y : Visablesize height / 4 ;
y = < mapsize height / 2 y : Mapsize height / 2 ;
point = CCP ( x y //target point
Point centerPoint = ccp(visableSize.width / 5, visableSize.height / 4);
Point ritPoint = ccpSub(centerPoint, desPoint);
getGameMap()->setPosition(ritPoint);
}
From for notes (Wiz)
The camera follows the lead and moves