本文整理汇总了C++中Explosion::IsDead方法的典型用法代码示例。如果您正苦于以下问题:C++ Explosion::IsDead方法的具体用法?C++ Explosion::IsDead怎么用?C++ Explosion::IsDead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Explosion
的用法示例。
在下文中一共展示了Explosion::IsDead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
{
SpawnExplosion(m_pPlayer->GetPositionX(), m_pPlayer->GetPositionY());
m_pPlayer->SetPositionX(tileSize);
m_pPlayer->SetPositionY(tileSize);
}
}
//player vs plat
for (platIterator = m_PlatVector.begin(); platIterator != m_PlatVector.end(); ++platIterator)
{
if ((*platIterator)->IsCollidingWith(*m_pPlayer))
{
float platPos = (*platIterator)->GetPositionY();
float platxPos = (*platIterator)->GetPositionX();
//right collision
if (m_pPlayer->GetPositionY() > (*platIterator)->GetPositionY())
{
m_pPlayer->SetPositionY(platPos + tileSize);
if (m_pPlayer->GetPositionX() < (*platIterator)->GetPositionX())
{
//m_pPlayer->SetPositionX(platxPos + tileSize);
m_pPlayer->SetVerticalVelocity(2.0f);
}
else if (m_pPlayer->GetPositionX() > (*platIterator)->GetPositionX())
{
m_pPlayer->SetVerticalVelocity(2.0f);
}
}
else
{
m_pPlayer->SetPositionY(platPos - tileSize);
if (m_pPlayer->GetPositionX() < (*platIterator)->GetPositionX())
{
m_pPlayer->SetVerticalVelocity(2.0f);
}
else if (m_pPlayer->GetPositionX() > (*platIterator)->GetPositionX())
{
m_pPlayer->SetVerticalVelocity(2.0f);
}
}
}
}
// Remove any dead bullets from the container...
bulletIterator = m_BulletVector.begin();
while(bulletIterator != m_BulletVector.end())
{
if((*bulletIterator)->IsDead() == true)
{
bulletIterator = m_BulletVector.erase(bulletIterator);
}
else
{
++bulletIterator;
}
}
// Remove any dead enemy aliens from the container...
enemyIterator = m_EnemyVector.begin();
while(enemyIterator != m_EnemyVector.end())
{
if((*enemyIterator)->IsDead() == true)
{
enemyIterator = m_EnemyVector.erase(enemyIterator);
}
else
{
++enemyIterator;
}
}
//remove explosions
std::vector<Explosion*>::iterator explosionIterator;
for (explosionIterator = Explosions.begin(); explosionIterator != Explosions.end();)
{
Explosion* explode = *explosionIterator;
if (explode->IsDead())
{
delete explode;
explosionIterator = Explosions.erase(explosionIterator);
}
else
{
explosionIterator++;
}
}
}