本文整理汇总了C++中Shot::IsVanished方法的典型用法代码示例。如果您正苦于以下问题:C++ Shot::IsVanished方法的具体用法?C++ Shot::IsVanished怎么用?C++ Shot::IsVanished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shot
的用法示例。
在下文中一共展示了Shot::IsVanished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//
// Update
//
void Game::Update()
{
list<Sprite *>::iterator it;
Sprite *curSpr;
static bool HPwarning = false;
static int chan = NULL;
if(showExitConfirm)
return;
UpdateMessages();
if(player->GetWeapon()==0)
RELOAD_TIME = 650;
if(player->GetWeapon()==1)
RELOAD_TIME = 280;
// Update sprites
for(it = sprites.begin(); it != sprites.end(); it++)
{
curSpr = *it;
if(curSpr->GetId() == ET_FURBY)
{
Furby *fb = (Furby *)curSpr;
fb->Update(raycaster);
}
else if(curSpr->GetId() == SHOT_INDEX)
{
Shot *shot = (Shot *)curSpr;
shot->Update(raycaster);
if(shot->PointCollWith(raycaster->GetPosX(), raycaster->GetPosY()))
{
if(player->GetHealth() != 0)
{
framework->PlaySound(PlayerHurt);
}
AddMessage("You got hit by a shot from a furby!");
player->DecrementHealth(10);
it = sprites.erase(it);
}
if(shot->IsVanished())
it = sprites.erase(it);
}
else if(curSpr->GetId() == DEATH_ANIMATION_INDEX)
{
DeathAnimation *da = (DeathAnimation *)curSpr;
da->Update();
if(da->HasEnded())
{
float itsX, itsY;
itsX = da->GetPosX();
itsY = da->GetPosY();
delete da;
it = sprites.erase(it);
Sprite *corpse = new Sprite(spriteImgs[2], itsX, itsY, 2);
sprites.push_back(corpse);
}
}
if(curSpr->GetId() == ET_SKULL)
{
Skull *sk = (Skull *)curSpr;
sk->Update(raycaster);
}
else if(curSpr->GetId() == SK_SHOT_INDEX)
{
SkullShot *skullshot = (SkullShot *)curSpr;
skullshot->Update(raycaster);
if(skullshot->PointCollWith(raycaster->GetPosX(), raycaster->GetPosY()))
{
if(player->GetHealth() !=0)
{
framework->PlaySound(PlayerHurt);
}
AddMessage("You got hit by a shot from a Skull!");
player->DecrementHealth(20);
it = sprites.erase(it);
}
if(skullshot->IsVanished())
it = sprites.erase(it);
}
else if(curSpr->GetId() == SKDEATH_ANIMATION_INDEX)
{
SKDeathAnimation *skda = (SKDeathAnimation *)curSpr;
skda->Update();
//.........这里部分代码省略.........