本文整理汇总了C++中Explosion::IsFinished方法的典型用法代码示例。如果您正苦于以下问题:C++ Explosion::IsFinished方法的具体用法?C++ Explosion::IsFinished怎么用?C++ Explosion::IsFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Explosion
的用法示例。
在下文中一共展示了Explosion::IsFinished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//.........这里部分代码省略.........
{
if (!mRobot->IsDead() && mRobot->GetVerticalVelocity() == -850.0f && crawler->GetState() != CrawlerWeak::CRAWLER_DYING)
{
// You lose a life:(
mRobot->SetLives(mRobot->GetLives() - 1);
Mix_PlayChannel(-1, mDieSound, 0);
// Stop the background music
Mix_HaltMusic();
if (mRobot->GetLives() == 0)
{
printf("\nGame over music is being played!");
Mix_VolumeMusic(32);
Mix_PlayMusic(mBadGameOverMusic, 0);
SetEntitiesGrayscale(true);
}
mRobot->Bounce(-400, true); // kill the robot
}
}
}
crawler->Update(dt);
++crawlerIt;
}
}
//
// update the explosions
//
std::list<Explosion*>::iterator it = mExplosions.begin();
while (it != mExplosions.end())
{
Explosion* entity = *it; // get a pointer to this explosion
if (entity->IsFinished())
{
it = mExplosions.erase(it); // remove the entry from the list and advance iterator
delete entity; // delete the object
}
else
{
entity->Update(dt); // update the entity
++it; // advance list iterator
}
}
//
// update the meteors
//
std::list<Meteor*>::iterator metIt = mMeteors.begin();
while (metIt != mMeteors.end())
{
Meteor* entity = *metIt; // get a pointer to this meteor
// If the meteor has either reached the ground, destroy it with an explosion
if (entity->GetRect().y > mScrHeight-32-64)
{
if (!mRobot->IsDead())
{
Mix_PlayChannel(-1, mThudSound, 0);
}
Explosion* boom = new Explosion(entity->GetRect().x + entity->GetRect().w / 2, entity->GetRect().y + entity->GetRect().h / 2);
mExplosions.push_back(boom);
metIt = mMeteors.erase(metIt); // remove the entry from the list and advance iterator
delete entity; // delete the object
}
// If the meteor has hit the robot from the top, destroy it with an explosion and also kill the robot