- Timestamp:
- Apr 30, 2015, 4:07:53 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.cc
r10406 r10408 108 108 }*/ 109 109 110 //Timer for the waves (10 seconds between the waves) 110 111 selecter = NULL; 111 112 this->player_ = NULL; … … 117 118 this->credit_ = 0; 118 119 this->lifes_ = 0; 119 120 //this->stats_ = new TowerDefensePlayerStats(); 120 this->timeSetTower_ = 0; 121 121 122 122 123 ModifyConsoleCommand(__CC_addTower_name).setObject(this); … … 222 223 en1->addTemplate("enemytowerdefense1"); 223 224 en1->setScale(3); 224 en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);225 en1->setHealth(en1->getHealth() +50 + this->getWaveNumber()*4); 225 226 break; 226 227 … … 228 229 en1->addTemplate("enemytowerdefense2"); 229 230 en1->setScale(2); 230 en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);231 en1->setHealth(en1->getHealth() -30 + this->getWaveNumber()*4); 231 232 // en1->setShieldHealth(en1->getShield() = this->getWaveNumber()*2)) 232 233 break; … … 235 236 en1->addTemplate("enemytowerdefense3"); 236 237 en1->setScale(1); 237 en1->setHealth(en1->getHealth() + this->getWaveNumber()*4);238 en1->setHealth(en1->getHealth() -10 + this->getWaveNumber()*4); 238 239 break; 239 240 } … … 390 391 SUPER(TowerDefense, tick, dt); 391 392 time +=dt; 393 timeSetTower_ +=dt; 394 orxout() << dt << "time" << endl; 395 396 //Check if tower has to be set (because TowerDefenseSelecter asks for it) 397 if(timeSetTower_ >= 0.25) 398 { 399 timeSetTower_ =0; 400 if(selecter != NULL && selecter->firePressed_) 401 { 402 403 int xcoord = selecter->selectedPos_->GetX(); 404 int ycoord = selecter->selectedPos_->GetY(); 405 Model* dummyModel2 = new Model(this->center_->getContext()); 406 407 408 409 if(towerModelMatrix[xcoord][ycoord] == NULL) 410 { 411 addTower(xcoord,ycoord); 412 } 413 else 414 { 415 if(!((towerModelMatrix [xcoord][ycoord])->getMeshSource() == dummyModel2->getMeshSource())) 416 { 417 towerTurretMatrix[xcoord][ycoord]->upgradeTower(); 418 } 419 } 420 selecter->firePressed_ = false; 421 } 422 } 392 423 393 424 TDCoordinate* coord1 = new TDCoordinate(1,1); 394 425 std::vector<TDCoordinate*> path; 395 426 path.push_back(coord1); 396 if(time>=TowerDefenseEnemyvector.size() && TowerDefenseEnemyvector.size() < 30) 397 { 398 //adds different types of enemys depending on the WaveNumber 399 addTowerDefenseEnemy(path, this->getWaveNumber() % 3 +1 ); 400 } 427 428 429 int enemytype = this->getWaveNumber() % 3 +1; 430 431 float randomnumber1 = rand()*100*5; 432 float randomnumber2 = rand()*100*1; 433 float randomnumber3 = rand()*100*1.5; 434 435 float totalnumber = randomnumber1 + randomnumber2 + randomnumber3; 436 int maxspaceships = 30; 437 int spaceships = (int)(maxspaceships* randomnumber1 / totalnumber); 438 int eggs = (int)(maxspaceships*randomnumber2 / totalnumber); 439 int ufos = (int)(maxspaceships*randomnumber3 / totalnumber); 440 441 if(time>=TowerDefenseEnemyvector.size() && TowerDefenseEnemyvector.size() < maxspaceships) 442 { 443 //adds different types of enemys depending on the WaveNumber 444 addTowerDefenseEnemy(path, enemytype); 445 } 446 401 447 402 448 Vector3* endpoint = new Vector3(500, 700, 150);
Note: See TracChangeset
for help on using the changeset viewer.