void Spider::Collision(Bullet* other) { health--; if(health < 1) { MarkForDestroy(); WaveManager::ResetAlarmForSpider(); if(myKiller->getPosition().x - Pos.y < 3) { scoreAddAmount = 900; ExplosionSpiderFactory::CreateExplosionSpider(Pos, "900"); } else if(myKiller->getPosition().x - Pos.y < 24) { scoreAddAmount = 600; ExplosionSpiderFactory::CreateExplosionSpider(Pos, "600"); } else { scoreAddAmount = 300; ExplosionSpiderFactory::CreateExplosionSpider(Pos, "300"); } ScoreManager::AddScore(scoreAddAmount); } }
void ExplosionMushroom::Update() { if ( MainSprite.IsLastAnimationFrame() ) MarkForDestroy(); MainSprite.setPosition(Pos); MainSprite.Update(); }
void Scorpion::Collision(Bullet* other) { health--; if(health < 1) MarkForDestroy(); ScoreManager::AddScore(scoreAddAmount); }
void Scorpion::Update() { if ((Pos.x>rightSpawnX&&leftRight>0)||(Pos.x<leftSpawnX&&leftRight<0))//TODO: make this suck less { ScorpionManager::GetInstance()->scorpionActive = NULL; MarkForDestroy(); WaveManager::GetInstance()->setScorpionTimer(); } Pos += sf::Vector2f(-1, 0); MainSprite.Update(); MainSprite.setPosition(Pos); }
//Checks current POS and if there is a shroom infect it void Scorpion::CheckInfectMushroom() { int X = (Pos.x / 16); int Y = (Pos.y / 16) - 1; if(field->isInstance(X, Y) && X >=0 && X <= 29) field->getElement(X, Y)->Infect(); if(X < -1 || X > 30) MarkForDestroy(); distnaceToNextLookAhead = SpriteSize; }
void Scorpion::Collision(Shot *other) { new Kill(Pos); ScorpionManager::GetInstance()->scorpionActive = NULL; while(!poisoned.empty()) { poisoned.front()->unPoison(); poisoned.pop(); } MarkForDestroy(); WaveManager::GetInstance()->setScorpionTimer(); //TODO: SCORE }
void CentipedeBodyPart::Collision(Bullet* other) { if(hasDescendant) descendant->RemoveAncestor(); ScoreManager::AddScore(30); WaveManager::CentipedeBodyPartDeath(); //Create Mushroom at the point of death int X = (Pos.x / 16) + moveDir;//Adjust to offset given its move position so a body part doesn't miss hitting it int Y = (Pos.y / 16) - 1;//Adjusting for the offset of the grid to the size of the window if(!mushroomField->isInstance(X, Y)) { mushroomField->SpawnShroom( X, Y); } MarkForDestroy(); }
//Checks current POS and if there is a shroom if so destroy it void Spider::CheckIfMushroom() { int X = (Pos.x / 16); int Y = (Pos.y / 16) - 1; if(field->isInstance(X, Y) && X >=0 && X <= 29)//Can only eat mushrooms within the field field->getElement(X, Y)->MarkForDestroy(); if(X < -1 || X > 30) { WaveManager::ResetAlarmForSpider(); MarkForDestroy(); } diag = rand() % 2; distnaceToNextLookAhead = SpriteSize; }
void Shot::Destroy() { MarkForDestroy(); //blaster = NULL; DeregisterCollision<Shot>( *this ); }
void ExplosionPlayer::Alarm0() { LevelManager::GetActiveLevel()->GetPlayer()->PlayerDeath(); MarkForDestroy(); }