Beispiel #1
0
void Planet::findPosition()
{
	Point2D a;
	for ( int j = 0; j <getPopulation(); j++)
	{
		for (int k = j + 1; k < getPopulation(); k++)
		{
			if (a.getDistance(population[j]->getPosition(), population[k]->getPosition()) < 5)
			{
				int random = rand() % 2 + 1;
				switch (random)
				{
				case 1:
					population[j]->Attack(*population[j]);
					break;
				case 2:
					addPopulation(entity, 1);

				}
			}
			else if (a.getDistance(population[j]->getPosition(), population[k]->getPosition()) == 0)
			{
				movePopulation();
			}
		}
	}
}