本文整理汇总了C++中TMXLayer::getMapTileSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TMXLayer::getMapTileSize方法的具体用法?C++ TMXLayer::getMapTileSize怎么用?C++ TMXLayer::getMapTileSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TMXLayer
的用法示例。
在下文中一共展示了TMXLayer::getMapTileSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _dealMap
void BattleLayer::_dealMap(){
Size visibleSize = Director::getInstance()->getVisibleSize();
_battleMapBackground = LayerColor::create(Color4B(0, 0, 0, 255), visibleSize.width, visibleSize.height);
_battleMapBackground->setPosition(0, 0);
this->addChild(_battleMapBackground, 0);
TMXTiledMap *tiledMap = TMXTiledMap::create("res/map/battle_map.tmx");
TMXLayer *backgroundLayer = tiledMap->getLayer("background");
TMXLayer *walkableLayer = tiledMap->getLayer("walkable");
walkableLayer->setAnchorPoint(Vec2(0.5, 0.5));
walkableLayer->setPosition(visibleSize.width / 2, visibleSize.height / 2 + 90);
_battleMapBackground->addChild(walkableLayer, 1);
backgroundLayer->setAnchorPoint(Vec2(0.5, 0.5));
backgroundLayer->setPosition(visibleSize.width / 2, visibleSize.height / 2 + 90);
_battleMapBackground->addChild(backgroundLayer, 1);
Size mapSize = walkableLayer->getLayerSize();
_battleMapTileSize = Size(20, 30);
_battleTileSize = walkableLayer->getMapTileSize();
_battleMapSize = Size(20 * _battleTileSize.width, 30 * _battleTileSize.height);
_battleMap = LayerColor::create(Color4B(255, 255, 255, 150), _battleMapSize.width, _battleMapSize.height);
_battleMap->ignoreAnchorPointForPosition(false);
_battleMap->setAnchorPoint(Vec2(0.5, 0.5));
_battleMap->setPosition(visibleSize.width / 2, visibleSize.height / 2 + 90);
_battleMapBackground->addChild(_battleMap, 5);
}
示例2: bulletBoom
void Bullet::bulletBoom()
{
Rect rect = getBoundingBox();
Size mapSize = mTileMapInfo->getTileMap()->getContentSize();
if (rect.getMinX() < 0 || rect.getMaxX() >= mapSize.width || rect.getMinY() < 0
|| rect.getMaxY() >= mapSize.height)
return;
TMXLayer* tmxLayer = mTileMapInfo->getTileMap()->getLayer("layer_0");
Size tileSize = tmxLayer->getMapTileSize();
float MinY = mapSize.height - rect.getMinY();
float MaxY = mapSize.height - rect.getMaxY();
Point pt = Point((int) rect.getMinX() / tileSize.width, (int) (MinY / tileSize.height));
if (gidToTileType[tmxLayer->getTileGIDAt(pt)] == tileWall)
tmxLayer->setTileGID(gidToTileType[tileNone], pt);
pt = Point((int) rect.getMinX() / tileSize.width, (int) (MaxY / tileSize.height));
if (gidToTileType[tmxLayer->getTileGIDAt(pt)] == tileWall)
tmxLayer->setTileGID(gidToTileType[tileNone], pt);
pt = Point((int) rect.getMaxX() / tileSize.width, (int) (MinY / tileSize.height));
if (gidToTileType[tmxLayer->getTileGIDAt(pt)] == tileWall)
tmxLayer->setTileGID(gidToTileType[tileNone], pt);
pt = Point((int) rect.getMaxX() / tileSize.width, (int) (MaxY / tileSize.height));
if (gidToTileType[tmxLayer->getTileGIDAt(pt)] == tileWall)
tmxLayer->setTileGID(gidToTileType[tileNone], pt);
}