本文整理汇总了C++中TileLayer::getMapHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ TileLayer::getMapHeight方法的具体用法?C++ TileLayer::getMapHeight怎么用?C++ TileLayer::getMapHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TileLayer
的用法示例。
在下文中一共展示了TileLayer::getMapHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkCollideTile
bool Actor::checkCollideTile(Vector2D newPos)
{
for (std::vector<TileLayer*>::iterator it = m_pCollisionLayers->begin(); it != m_pCollisionLayers->end(); ++it)
{
TileLayer* pTileLayer = (*it);
//Check in Map Bounds Before We Bother Checking Collision // Otherwise NO Tiles Stupid!
if (newPos.m_x > 0 && newPos.m_x < pTileLayer->getMapWidth() - 100 && newPos.m_y > 0 && newPos.m_y < pTileLayer->getMapHeight())
{
std::vector<std::vector<int>> tiles = pTileLayer->getTileIDs();
Vector2D layerPos = pTileLayer->getPosition();
int x, y, tileColumn, tileRow, tileID = 0;
// get specific tile
x = layerPos.getX() / pTileLayer->getTileSize();
y = layerPos.getY() / pTileLayer->getTileSize();
Vector2D startPos = newPos;
startPos.m_x;
startPos.m_y;
Vector2D endPos(newPos.m_x + (m_width), newPos.m_y + (m_height));
for (int i = startPos.m_x; i < endPos.m_x; ++i)
{
for (int j = startPos.m_y; j < endPos.m_y; ++j)
{
tileColumn = i / pTileLayer->getTileSize();
tileRow = j / pTileLayer->getTileSize();
tileID = tiles[tileRow + y][tileColumn + x];
if (tileID != 0)
{
return true;
}
}
}
}
}
return false;
}