Example #1
0
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);
	}
}
Example #2
0
void ExplosionMushroom::Update()
{
	if ( MainSprite.IsLastAnimationFrame() )
		MarkForDestroy();

	MainSprite.setPosition(Pos);
	MainSprite.Update();
}
Example #3
0
void Scorpion::Collision(Bullet* other)
{
	health--;
	if(health < 1)
		MarkForDestroy();

	ScoreManager::AddScore(scoreAddAmount);
}
Example #4
0
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);
}
Example #5
0
//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;
}
Example #6
0
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
}
Example #7
0
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();
}
Example #8
0
//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;
}
Example #9
0
void Shot::Destroy()
{
	MarkForDestroy();
	//blaster = NULL;
	DeregisterCollision<Shot>( *this );
}
Example #10
0
void ExplosionPlayer::Alarm0()
{
	LevelManager::GetActiveLevel()->GetPlayer()->PlayerDeath();
	MarkForDestroy();
}