本文整理汇总了C++中AssetManager::GetExplosionTopEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ AssetManager::GetExplosionTopEnd方法的具体用法?C++ AssetManager::GetExplosionTopEnd怎么用?C++ AssetManager::GetExplosionTopEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AssetManager
的用法示例。
在下文中一共展示了AssetManager::GetExplosionTopEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GameObject
Explosion::Explosion(const AssetManager& assets, int xPosition, int yPosition, int power, std::list<GameObject*>& objects, const Map& map)
: GameObject(Rectangle(xPosition, yPosition, 0, 0), 14),
parts_()
{
// Create the explosion parts.
parts_.push_back(ExplosionPart(assets.GetExplosionCenter(), xPosition, yPosition, 14));
// Each loop expands in one direction as long as not blocked and as long as the power is not exhausted.
// Top
bool block = false;
for (int i = 1; (i <= power) && (block == false); ++i)
{
if (CanExplode(Rectangle(xPosition, yPosition - 48 * i, 48, 48), objects, map, block) == true)
{
AnimatedSprite* sprite = (i == power) ? assets.GetExplosionTopEnd() : assets.GetExplosionVertical(); // The final part has its own sprites.
parts_.push_back(ExplosionPart(sprite, xPosition, yPosition - 48 * i, 14));
}
}
// Right
block = false;
for (int i = 1; (i <= power) && (block == false); ++i)
{
if (CanExplode(Rectangle(xPosition + 48 * i, yPosition, 48, 48), objects, map, block) == true)
{
AnimatedSprite* sprite = (i == power) ? assets.GetExplosionRightEnd() : assets.GetExplosionHorizontal();
parts_.push_back(ExplosionPart(sprite, xPosition + 48 * i, yPosition, 14));
}
}
// Bottom
block = false;
for (int i = 1; (i <= power) && (block == false); ++i)
{
if (CanExplode(Rectangle(xPosition, yPosition + 48 * i, 48, 48), objects, map, block) == true)
{
AnimatedSprite* sprite = (i == power) ? assets.GetExplosionBottomEnd() : assets.GetExplosionVertical();
parts_.push_back(ExplosionPart(sprite, xPosition, yPosition + 48 * i, 14));
}
}
// Left
block = false;
for (int i = 1; (i <= power) && (block == false); ++i)
{
if (CanExplode(Rectangle(xPosition - 48 * i, yPosition, 48, 48), objects, map, block) == true)
{
AnimatedSprite* sprite = (i == power) ? assets.GetExplosionLeftEnd() : assets.GetExplosionHorizontal();
parts_.push_back(ExplosionPart(sprite, xPosition - 48 * i, yPosition, 14));
}
}
}