Esempio n. 1
0
void GameScene::changeMap(Point startPoint,int mapPoint){
	this->removeChildByName("map");
	this->removeChildByTag(sGlobal->mapNum);
	sGlobal->mapNum = mapPoint;
	MyMap* myMap = MyMap::create();
	sGlobal->map = myMap->m_map;
	sGlobal->myMap = myMap;
	myMap->setPosition(Point(100, 100));
	myMap->m_map->setPosition(Point(-100, -100));
	this->addChild(myMap, 5, sGlobal->mapNum);
	this->addChild(myMap->m_map,6,"map");
	/*myMap->setPosition(Point(0, 0));*/
	myMap->m_map->addChild(sGlobal->hero);
	/*sGlobal->map->addChild(sGlobal->hero);*/
	sGlobal->hero->setTiledMap(sGlobal->map);
	sGlobal->hero->setPosition(sGlobal->myMap->positionForTileCoord(startPoint));
	/*this->addHero(sGlobal->map, sGlobal->myMap->positionForTileCoord(startPoint-Point(2,2)));*/
	CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("WhenInSchool.mp3", true);
}