Exemple #1
0
void placeMonster (char entityArray[MAP_SIZE][MAP_SIZE], entity entityInfo[], char mapArray[MAP_SIZE][MAP_SIZE], int roomWidth, int roomHeight, int monNumber) {
   int posx,posy;
   generatePosition(roomWidth, roomHeight, &posx, &posy);
   while ((mapArray[posx][posy]!= EMPTY_SPACE) || (entityArray[posx][posy] != NO_ENTITY)) {
      generatePosition(roomWidth, roomHeight, &posx, &posy);
   }
   char symbolChoose = randint(4); //char to save space
   char monSymbol;
   if (symbolChoose == 0) { //choose a non-unique symbol for the monster
// you wanted a unique identifier? maybe next time
      monSymbol = '#';
   } else if (symbolChoose == 1) {
      monSymbol = '&';
   } else if (symbolChoose == 2) {
      monSymbol = '$';
   } else if (symbolChoose == 3) {
      monSymbol = '+';
   } else if (symbolChoose == 4) {
      monSymbol = '*';
   }
   entityArray[posx][posy] = monSymbol; //dump all the map specific info on the entity
   entityInfo[monNumber].entityx = posx;
   entityInfo[monNumber].entityy = posy;
   entityInfo[monNumber].entitySymbol = monSymbol;
   return;
}
Exemple #2
0
void placePlayer (char entityArray[MAP_SIZE][MAP_SIZE], entity entityInfo[], char mapArray[MAP_SIZE][MAP_SIZE], int roomWidth, int roomHeight) {
   int posx,posy;
   generatePosition(roomWidth, roomHeight, &posx, &posy);
   while ((mapArray[posx][posy])!= EMPTY_SPACE) {
      generatePosition(roomWidth, roomHeight, &posx, &posy);
      printf("%c\n",mapArray[posx][posy]);
   }
   entityArray[posx][posy] = PLAYER_CHAR;
// the player character will always be designated with @
   entityInfo[0].entityx = posx;
   entityInfo[0].entityy = posy;
   return;
}
void Room::generateTreasureChest() {
    enemies.push_back(new TreasureChest(generatePosition(TreasureChest::radio)));
    for (int i=0 ; i<6 ;++i){ // 6 tesoros en el cofre
        int t = std::uniform_int_distribution<int>(0,3)(random_engine);
        enemies.back()->createItem(t);
    }
}
Exemple #4
0
InCLogo::InCLogo(int earlyPositionX, int earlyPositionY) : Item()
{
    //step("[InCLogo] Constructing.");
    imagePath.assign("res/images/s_item.png");
    generatePosition(earlyPositionX, earlyPositionY, 40, 40);
    generateClips();
    id = 7;
}
Exemple #5
0
void UsiClient::search() {
  OUT(info) << "search thread is started. tid=" << std::this_thread::get_id();

  auto pos = generatePosition(record_, -1);
  auto config = searcher_->getConfig();

  if (isInfinite_) {
    config.maximumTimeMs = SearchConfig::InfinityTime;
    config.optimumTimeMs = SearchConfig::InfinityTime;

  } else {
    bool isBlack = pos.getTurn() == Turn::Black;
    TimeType remainingTimeMs = isBlack ?  blackTimeMs_ : whiteTimeMs_;
    config.maximumTimeMs = remainingTimeMs + byoyomiMs_ - options_.marginMs;
    config.optimumTimeMs = std::max(remainingTimeMs / 50,
                           std::min(remainingTimeMs, byoyomiMs_/* + incrementMs*/))
                         + byoyomiMs_;

    if (options_.snappy) {
      config.optimumTimeMs /= 3;
    }

    if (!options_.snappy && remainingTimeMs == 0/* && incrementMs == 0*/) {
      config.optimumTimeMs = SearchConfig::InfinityTime;
    }
  }

  searcher_->setConfig(config);

  searcher_->idsearch(pos, Searcher::DepthInfinity, &record_);

  if (isInfinite_) {
    waitForStopCommand();
  }

  const auto& result = searcher_->getResult();
  const auto& info = searcher_->getInfo();
  bool canPonder = !result.move.isNone() &&
                   result.pv.size() >= 2;

  // send the result of search
  if (canPonder) {
    send("bestmove", result.move.toStringSFEN(),
           "ponder", result.pv.getMove(1).toStringSFEN());
  } else if (!result.move.isNone()) {
    send("bestmove", result.move.toStringSFEN());
  } else {
    send("bestmove", "resign");
  }

  // print the result of search
  printSearchInfo(OUT(info), info, result.elapsed);

  // notify to receiver
  breakReceive();

  OUT(info) << "search thread is stopped. tid=" << std::this_thread::get_id();
}
Exemple #6
0
AntiBoss::AntiBoss(int earlyPositionX, int earlyPositionY) : Item()
{
    //step("[AntiBoss] Constructing.");
    imagePath.assign("res/images/s_item.png");
    generatePosition(earlyPositionX, earlyPositionY, 32, 40);
    generateClips();
    m_dropspeed = 5;
    id = 8;
}
Exemple #7
0
AlteredPotion::AlteredPotion(int earlyPositionX, int earlyPositionY) : Item()
{
    //step("[AlteredPotion] Constructing.");
    imagePath.assign("res/images/s_item.png");
    generatePosition(earlyPositionX, earlyPositionY, 32, 40);
    generateClips();
    m_dropspeed = 5;
    id = 2;
}
static int changeSameKey (char *key, ArrayHashTable2 *hashTable, ArrayHashTableElement2 *element)
{
	unsigned int pos=generatePosition(key, hashTable->size);
	ArrayHashTableElement2 *try=hashTable->hashArray[pos];
	if (try==NULL) return -1;
	int newIndex=solveConflict(pos, key, hashTable);
	if (newIndex==-1)
		return -1;
	free(hashTable->hashArray[newIndex]);
	hashTable->hashArray[newIndex]=element;
	return 1;
}
Exemple #9
0
Curupira::Curupira(int item, int earlyPosition) : Enemy() 
{
	//step("[Curupira] Constructing.");
	imagePath.assign("res/images/s_curupira.png");
	generatePosition(earlyPosition,(getPlatformH()-15),50,15);
	generateClips();
	generateBehaviour();
	m_item = item;
	m_rose = false;
	m_state = UNDERGROUND;
	m_looking = BACKWARD;
	setClipNumber(18);
}
void GameManager::resetOrange(int i)
{

	int quadrante = rand() % NQUADRANTES;
	double dir = generateNumber(365, 1);

	Orange *o = _oranges[i];

	if (!pauseFlag) {
		if ((o->getSpeedState() == true) && o->getCurrentSpeed() <= MAX_SPEED) {
			o->setCurrentSpeed(generateNumber(o->getCurrentSpeed() + SPEEDHIGHERINC, o->getCurrentSpeed() + SPEEDLOWERINC));
			o->setSpeedState(false);
		}

		o->setPosition(generatePosition(quadrante, 0), generatePosition(quadrante, 1), 2.6);
		o->setDirection(cos(dir*(PI / 180)), sin(dir*(PI / 180)), 0);
		o->setAngle(0);
		o->setLifeState(true);
	}

	o->setWaitingState(false);
}
Exemple #11
0
void UsiClient::ponder() {
  OUT(info) << "ponder thread is started. tid=" << std::this_thread::get_id();

  record_.moveList.pop_back();
  auto pos = generatePosition(record_, -1);
  auto config = searcher_->getConfig();

  config.maximumTimeMs = SearchConfig::InfinityTime;
  config.optimumTimeMs = SearchConfig::InfinityTime;

  searcher_->setConfig(config);

  searcher_->idsearch(pos, Searcher::DepthInfinity, &record_);

  OUT(info) << "ponder thread is stopped. tid=" << std::this_thread::get_id();
}
Exemple #12
0
static Querier* generateQuery(QueryHandler* handler, const BoundingBox3& region, bool static_queries, const SolidAngle& qmin, const SolidAngle& qmax, const float q_distance, uint32 q_max_results) {
    Vector3 qpos = generatePosition(region);
    Vector3 qvel = generateDirection(!static_queries);

    MotionPath::MotionVectorListPtr mpl(new MotionPath::MotionVectorList());
    mpl->push_back(MotionVector3(Time::null(), qpos, qvel));

    Querier* querier = new Querier(handler,
        MotionPath(Vector3(0,0,0), mpl),
        generateQueryBounds(),
        generateQueryRadius(),
        generateQueryAngle(qmin, qmax),
        q_distance,
        q_max_results
    );
    return querier;
}
void Room::generateEnemies(int lv,bool type) {
    if (type){// salida, hay 1 boss
        int t = std::uniform_int_distribution<int>(0, 2)(random_engine); //tipo de enemigo
        if (t == 0)
            enemies.push_back(new Raticate(generatePosition(Raticate::radio),lv+5));
        else if (t == 1)
            enemies.push_back(new Golem(generatePosition(Golem::radio),lv+5));
        else if (t== 2)
            enemies.push_back(new Arbok(generatePosition(Arbok::radio),lv+5));

    }else{
        int num_enemies = std::uniform_int_distribution<int>(1, 4)(random_engine);
        for (int i = 0; i < num_enemies; ++i) {
            int l = std::uniform_int_distribution<int>(0, 3)(random_engine); //level aleatorio
            int t = std::uniform_int_distribution<int>(0, 2)(random_engine); //tipo de enemigo
            if (t == 0)
                enemies.push_back(new Raticate(generatePosition(Raticate::radio),lv+l));
            else if (t == 1)
                enemies.push_back(new Golem(generatePosition(Golem::radio),lv+l));
            else
                enemies.push_back(new Arbok(generatePosition(Arbok::radio),lv+l));
        }
    }
}
Exemple #14
0
bool UsiClient::runSearch(const CommandArguments& args) {
  blackTimeMs_ = 0;
  whiteTimeMs_ = 0;
  byoyomiMs_ = 0;
  isInfinite_ = false;

  for (size_t i = 1; i < args.size(); i++) {
    if (args[i] == "btime") {
      blackTimeMs_ = strtol(args[++i].c_str(), nullptr, 10);

    } else if (args[i] == "wtime") {
      whiteTimeMs_ = strtol(args[++i].c_str(), nullptr, 10);

    } else if (args[i] == "byoyomi") {
      byoyomiMs_ = strtol(args[++i].c_str(), nullptr, 10);

    } else if (args[i] == "infinite") {
      isInfinite_ = true;
    }
  }

  OUT(info) << "btime    : " << blackTimeMs_;
  OUT(info) << "wtime    : " << whiteTimeMs_;
  OUT(info) << "byoyomi  : " << byoyomiMs_;
  OUT(info) << "inifinite: " << (isInfinite_ ? "true" : "false");

  // check opening book
  if (options_.useBook) {
    auto pos = generatePosition(record_, -1);
    Move bookMove = BookUtil::select(book_, pos, random_);
    if (!bookMove.isNone()) {
      OUT(info) << "opening book hit";
      send("bestmove", bookMove.toStringSFEN());
      return true;
    }
  }

  searcherIsStarted_ = false;
  stopCommandReceived_ = false;
  inPonder_ = false;

  ScopedThread searchThread;
  searchThread.start([this]() {
    search();
  }, [this]() {
    searcher_->interrupt();
    stopCommandReceived_ = true;
  });
  waitForSearcherIsStarted();

  auto command = receiveWithBreak();
  if (command.state == CommandState::Broken) {
    return true;
  }

  if (command.state != CommandState::Ok) {
    return false;
  }

  auto args2 = StringUtil::split(command.value, [](char c) {
    return isspace(c);
  });

  if (args2[0] == "stop") {
    return true;
  }

  deferredCommands_.push(command.value);
 
  return true;
}
void GameManager::init()
{
	int quadrante;
	double direction;

	std::srand(std::time(0));


	//Initializing Flags
	wireFlag = false;
	dirLightFlag = false;
	spotLightFlag = false;
	pointLightFlag = false;
	activateLights = false;
	shadeFlag = false;
	pauseFlag = false;
	startFlag = false;


	//Constructing Textures
	//_pauseTex = new Texture("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\pause.jpg");
	//_gameOverTex = new Texture("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\gameover.jpg");

	_pausePlane = new Plane(0, 0, 10);
	_pausePlane->setFileName("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\pause.png");
	_gameOverPlane = new Plane(0, 0, 10);
	_gameOverPlane->setFileName("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\rip.png");
	
	//Constructing Objects//
	Table * table = new Table();
	table->setPosition(0, 0, 0);
	//table->setTexture("C:\\Users\\DanielaD\\Desktop\\MicroMachines CG\\wood.png");
	_gameObjects.push_back(table);

	Roadside * roadside = new Roadside();
	roadside->setPosition(0, 0, 0.05);
	_gameObjects.push_back(roadside);


	//criar a posicao de cada cheerio (outer road)
	int angle = 0;
	double x, y;

	while (angle < 360) {
		x = OUTTERLENGTH * cos((angle)*(PI / 180));
		y = OUTTERLENGTH * sin((angle)*(PI / 180));

		Cheerio *cNew = new Cheerio(x, y, 1.6);
		roadside->insertCheerio(cNew);
		_gameObjects.push_back(cNew);
		angle += OUTTER_ANGLE_INCREASE;
	}

	//criar a posicao de cada cheerio (inner road)
	angle = 0;

	while (angle < 360) {
		x = INNERLENGTH * cos((angle)*(PI / 180));
		y = INNERLENGTH * sin((angle)*(PI / 180));

		Cheerio *cNew = new Cheerio(x, y, 1.6);
		roadside->insertCheerio(cNew);
		_gameObjects.push_back(cNew);
		angle += INNER_ANGLE_INCREASE;
	}

	_car = new Car();
	_car->setPosition(-12, 0, 1.7);
	_car->setRight(false);
	_car->setLeft(false);
	_car->setUp(false);
	_car->setDown(false);
	_gameObjects.push_back(_car);

	x = -14, y = -14;
	for (int i = 0; i < _lifes; i++) {
		Car* tempLife = new Car();
		tempLife->setPosition(x, y, 10);
		tempLife->setRight(false);
		tempLife->setLeft(false);
		tempLife->setUp(false);
		tempLife->setDown(false);
		_lifeVector.push_back(tempLife);
		x += 1.5;
	}


	Butter * butter1 = new Butter();
	butter1->setPosition(3, 12, 1.6);
	_gameObjects.push_back(butter1);

	Butter * butter2 = new Butter();
	butter2->setPosition(4, 13, 1.6);
	_gameObjects.push_back(butter2);

	Butter * butter3 = new Butter();
	butter3->setPosition(5, 12, 1.6);
	_gameObjects.push_back(butter3);

	Butter * butter4 = new Butter();
	butter4->setPosition(-3, -10, 1.6);
	_gameObjects.push_back(butter4);

	Butter * butter5 = new Butter();
	butter5->setPosition(-2, -11, 1.6);
	_gameObjects.push_back(butter5);


	for (int i = 0; i < NORANGES; i++) {

		Orange * orange = new Orange();

		quadrante = rand() % NQUADRANTES;
		direction = generateNumber(365, 1);

		orange->setId(i);
		orange->setPosition(generatePosition(quadrante, 0), generatePosition(quadrante, 1), 2.5);
		orange->setCurrentSpeed(generateNumber(SPEEDHIGHERINI, SPEEDLOWERINI));
		orange->setDirection(cos(direction*(PI / 180)), sin(direction*(PI / 180)), 0);
		orange->setLifeState(true);

		_gameObjects.push_back(orange);
		_oranges.push_back(orange);
	}


	//Constructing Camera
	_2dCamera = new OrthogonalCamera();
	_2dCamera->setEye(0, 0, 15);
	_2dCamera->setCenter(0, 0, 1);
	_2dCamera->setUp(0, 1, 0);
	_2dCamera->setLowerLimits(-15, -15, -15);
	_2dCamera->setUpperLimits(15, 15, 15);
	_activeCamera = _2dCamera;

	_guiCamera = new OrthogonalCamera();
	_guiCamera->setEye(0, 0, 20);
	_guiCamera->setCenter(0, 0, 1);
	_guiCamera->setUp(0, 1, 0);
	_guiCamera->setLowerLimits(-15, -15, -15);
	_guiCamera->setUpperLimits(15, 15, 15);

	_fieldCamera = new PerspectiveCamera();
	_fieldCamera->setEye(-20, -20, 20);
	_fieldCamera->setCenter(0, 0, 2);
	_fieldCamera->setUp(20, 20, 19);
	_fieldCamera->update(90, 1, 0.01, 150);

	_carCamera = new PerspectiveCamera();
	_carCamera->setEye(_car->getPosition()->getX() - (CAR_CAMERA_DISTANCE * (cos(_car->getCurrentAngle() * (PI / 180)))),
		_car->getPosition()->getY() - (CAR_CAMERA_DISTANCE * (sin(_car->getCurrentAngle() * (PI / 180)))),
		CAR_CAMERA_DISTANCE);
	_carCamera->setCenter(_car->getPosition()->getX(), _car->getPosition()->getY(), _car->getPosition()->getZ());
	//_carCamera->setUp(_car->getSpeed()->getX(), _car->getSpeed()->getY(), _car->getSpeed()->getZ());
	_carCamera->setUp(0, 0, 1);
	_carCamera->update(60, 1, 0.01, 150);


	//Constructing light sources

	Vela* vela1 = new Vela();
	vela1->setPosition(-6, 6, 1.6);
	_gameObjects.push_back(vela1);

	Vela* vela2 = new Vela();
	vela2->setPosition(6, 6, 1.6);
	_gameObjects.push_back(vela2);

	Vela* vela3 = new Vela();
	vela3->setPosition(0, -6, 1.6);
	_gameObjects.push_back(vela3);

	Vela* vela4 = new Vela();
	vela4->setPosition(-10, -10, 1.6);
	_gameObjects.push_back(vela4);

	Vela* vela5 = new Vela();
	vela5->setPosition(10, -10, 1.6);
	_gameObjects.push_back(vela5);

	Vela* vela6 = new Vela();
	vela6->setPosition(0, 14, 1.6);
	_gameObjects.push_back(vela6);


	LightSource* daylight = new LightSource(0);
	daylight->setPosition(0, 0, 10, 0);
	daylight->setAmbient(0.5, 0.5, 0.5, 1);
	daylight->setDiffuse(1, 1, 1, 1);
	daylight->setSpecular(1, 1, 1, 1);
	_lightSources.push_back(daylight);

	LightSource* candle1 = new LightSource(1);
	candle1->setPosition(-6, 6, 1, 1);
	candle1->setAmbient(0.7, 0.7, 0.7, 1);
	candle1->setDiffuse(1, 1, 1, 1);
	candle1->setSpecular(1, 1, 1, 1);
	candle1->setAttenuation(1, 0, 0.1);
	_lightSources.push_back(candle1);

	LightSource* candle2 = new LightSource(2);
	candle2->setPosition(6, 6, 1, 1);
	candle2->setAmbient(0.7, 0.7, 0.7, 1);
	candle2->setDiffuse(1, 1, 1, 1);
	candle2->setSpecular(1, 1, 1, 1);
	candle2->setAttenuation(1, 0, 0.1);
	_lightSources.push_back(candle2);

	LightSource* candle3 = new LightSource(3);
	candle3->setPosition(0, -6, 1, 1);
	candle3->setAmbient(0.7, 0.7, 0.7, 1);
	candle3->setDiffuse(1, 1, 1, 1);
	candle3->setSpecular(1, 1, 1, 1);
	candle3->setAttenuation(1, 0, 0.1);
	_lightSources.push_back(candle3);

	LightSource* candle4 = new LightSource(4);
	candle4->setPosition(-10, -10, 1, 1);
	candle4->setAmbient(0.7, 0.7, 0.7, 1);
	candle4->setDiffuse(1, 1, 1, 1);
	candle4->setSpecular(1, 1, 1, 1);
	candle4->setAttenuation(1, 0, 0.1);
	_lightSources.push_back(candle4);

	LightSource* candle5 = new LightSource(5);
	candle5->setPosition(10, -10, 1, 1);
	candle5->setAmbient(0.7, 0.7, 0.7, 1);
	candle5->setDiffuse(1, 1, 1, 1);
	candle5->setSpecular(1, 1, 1, 1);
	candle5->setAttenuation(1, 0, 0.1);
	_lightSources.push_back(candle5);

	LightSource* candle6 = new LightSource(6);
	candle6->setPosition(0, 15, 1, 1);
	candle6->setAmbient(0.7, 0.7, 0.7, 1);
	candle6->setDiffuse(1, 1, 1, 1);
	candle6->setSpecular(1, 1, 1, 1);
	candle6->setAttenuation(1.0, 0, 0.1);
	_lightSources.push_back(candle6);

	LightSource* spotlight = new LightSource(7);
	spotlight->setAmbient(0.8, 0.8, 0.8, 1);
	spotlight->setDiffuse(1, 1, 1, 1);
	spotlight->setSpecular(1, 1, 1, 1);
	spotlight->setExponent(new GLfloat(5));
	spotlight->setCutOff(new GLfloat(40));
	spotlight->setAttenuation(0, 0.6, 0.3);
	_lightSources.push_back(spotlight);

	initIsDone = true;
}
Exemple #16
0
	void ZombieGame::init() {
		keyboard_ = DevicePtr(new InputKeyboard(SDLK_UP, SDLK_DOWN, SDLK_LEFT,
			SDLK_RIGHT, SDLK_SPACE, SDLK_r, SDLK_LSHIFT, SDLK_e));		
		clipsize_ = 0;
		bulletsInWeapon_ = 0;
		health_ = 0;
		scale_ = 1.f;
		lastSpawnTime_ = engine_.getTime();
		spawnPeriod_ = 0.5f;

		addKeyListener([&](gui::Component& component, const SDL_Event& keyEvent) {
			keyboard_->eventUpdate(keyEvent);
		});

		if (zombieEntry_.getDeepChildEntry("music switch").getBool()) {
			music_ = zombieEntry_.getDeepChildEntry("music track").getMusic();
			music_.setVolume(zombieEntry_.getDeepChildEntry("music volume").getFloat());
			music_.play(-1);
		}

		tree_ = zombieEntry_.getDeepChildEntry("tree image").getSprite();
		wall_ = zombieEntry_.getDeepChildEntry("buildings wallImage").getSprite();
		nbrUnits_ = 0;

		unitMaxLimit_ = zombieEntry_.getDeepChildEntry("settings unitLimit").getInt();

		innerSpawnRadius_ = zombieEntry_.getDeepChildEntry("settings innerSpawnRadius").getFloat();
		outerSpawnRadius_ = zombieEntry_.getDeepChildEntry("settings outerSpawnRadius").getFloat();
		
		terrain_.loadRoadSprites(zombieEntry_.getDeepChildEntry("roads"));
		loadTerrain();
		
		explosionProperties_ = zombie::loadExplosion(zombieEntry_.getDeepChildEntry("explosion"));

		humanInjured_ = zombieEntry_.getDeepChildEntry("human injuredAnimation").getAnimation();
		humanDie_ = zombieEntry_.getDeepChildEntry("human dieAnimation").getAnimation();
		Unit2D human(loadUnit(this, "human", zombieEntry_, false));
		human.setDieSound(zombieEntry_.getDeepChildEntry("human dieSound").getSound());
		human.setHitSound(zombieEntry_.getDeepChildEntry("human hitSound").getSound());
		
		zombieInjured_ = zombieEntry_.getDeepChildEntry("zombie injuredAnimation").getAnimation();
		zombieDie_ = zombieEntry_.getDeepChildEntry("zombie dieAnimation").getAnimation();
		Unit2D zombie(loadUnit(this, "zombie", zombieEntry_, true));
		zombie.setDieSound(zombieEntry_.getDeepChildEntry("zombie dieSound").getSound());
		zombie.setHitSound(zombieEntry_.getDeepChildEntry("zombie hitSound").getSound());

		// Add human to engine.
		{
			State state(Position(85,120), ORIGO, 0);
			//Position p = generatePosition(spawningPoints_);
			//State state(Position(200,200), ORIGO, 0);
			Unit* unit = units_.pushBack(human);
			engine_.add(unit);
			unit->setState(state);
			unit->setActive(true);
			unit->setAwake(true);
			players_.push_back(std::unique_ptr<HumanPlayer>(new HumanPlayer(keyboard_, unit)));
			viewPosition_ = state.position_;
			refViewPosition_ = viewPosition_;
			++nbrUnits_;
		}

		// Add zombies to engine.
		calculateValidSpawningPoints(units_[0]);
		unsigned int unitLevel = zombieEntry_.getDeepChildEntry("settings unitLevel").getInt();
		for (unsigned int i = 1; i <= unitLevel && i < units_.getMaxSize(); ++i) {
			Position p = generatePosition(vaildSpawningPoints_);
			float angle = calculateAnglePointToPoint(p, units_[0].getPosition());
			State state(p, ORIGO, angle);
			Unit* unit = units_.pushBack(zombie);
			engine_.add(unit);
			unit->setState(state);
			unit->setActive(true);
			unit->setAwake(true);
			players_.push_back(std::unique_ptr<ZombieBehavior>(new ZombieBehavior(unit)));
		}
	
		// Add cars to engine.
		Car2D car(zombie::loadCar(zombieEntry_.getDeepChildEntry("car")));
		for (unsigned int i = 0; i < 8 && i < units_.getMaxSize(); ++i) {
			State state(Position(85,130), ORIGO, 0);
			Car* c = cars_.pushBack(car);
			engine_.add(c);
			c->setState(state);
			c->setActive(true);
			c->setAwake(true);
		}

		// Add missile to engine.
		Missile2D missile(loadMissile2D(this, zombieEntry_.getDeepChildEntry("equipment missile")));
		for (unsigned int i = 0; i < 10 && i < units_.getMaxSize(); ++i) {
			engine_.add(missiles_.emplaceBack(missile));
		}

		setBackgroundColor(0, 0.1f, 0);
		zombiesKilled_ = 0;

		drawBuildings_.createVBO(buildings_, wall_.getTexture());
	}
Ship* SolarSystem::spawnShip(PlaySpace* space)
{
	spawnShip(generatePosition(), space);
}