Changeset 10451
- Timestamp:
- May 21, 2015, 4:10:10 PM (10 years ago)
- Location:
- code/branches/towerdefenseFS15/src/modules/towerdefense
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.cc
r10430 r10451 95 95 static const int upgradeCost = 20; 96 96 static const int towerCost = 20; 97 unsigned int maxspaceships = 30; 98 int maxspaceshipsstandard = 30; 99 97 100 98 101 … … 419 422 void TowerDefense::nextwave() 420 423 { 424 425 orxout() << "newwave" << endl; 421 426 TowerDefenseEnemyvector.clear(); 422 427 waves_++; 428 //maxspaceships = round(maxspaceshipsstandard + 0.25*(waves_)); 423 429 time=0; 424 float randomnumber1 = rand()*100*5; 425 float randomnumber2 = rand()*100*1; 426 float randomnumber3 = rand()*100*1.5; 427 428 float totalnumber = (randomnumber1 + randomnumber2 + randomnumber3)*1.3; 429 430 int newspaceships = (int)(maxspaceships* randomnumber1 / totalnumber); 431 int neweggs = (int)(maxspaceships*randomnumber2 / totalnumber); 432 int newufos = (int)(maxspaceships*randomnumber3 / totalnumber); 433 int newrandomships = maxspaceships -spaceships - eggs - ufos; 434 int spaceships =newspaceships; 435 int eggs=neweggs; 436 int ufos=newufos; 437 int randomships=newrandomships; 430 431 int helpnumber = 40 -(waves_); 432 if(helpnumber <= 0) {helpnumber =1;} 433 float numSpaceships = std::abs((rand() % 100)*5*(helpnumber)); 434 float numEggs = std::abs((rand() % 100)*1*(waves_)); 435 float numUfos = std::abs((rand() % 100)*1.5*(0.5*(waves_))) ; 436 437 float totalnumber = (numSpaceships + numEggs + numUfos)*1.3; 438 439 int newspaceships = (int)(maxspaceships* numSpaceships / totalnumber); 440 int neweggs = (int)(maxspaceships*numEggs / totalnumber); 441 int newufos = (int)(maxspaceships*numUfos / totalnumber); 442 int newrandomships = maxspaceships -newspaceships - neweggs - newufos; 443 spaceships =newspaceships; 444 eggs=neweggs; 445 ufos=newufos; 446 randomships=newrandomships; 447 448 orxout() << spaceships << endl; 449 orxout() << eggs << endl; 450 orxout() << ufos << endl; 451 orxout() << randomships << endl; 452 453 454 455 438 456 439 457 } … … 469 487 if(towerTurretMatrix[x][y]->upgrade < towerTurretMatrix[x][y]->upgradeMax) 470 488 { 471 this->buyTower((int)(upgradeCost*(std::pow(1.5,towerTurretMatrix[x][y]->upgrade)))); 472 switch(towerTurretMatrix[x][y]->upgrade) 473 { 474 case 1 : 475 towerModelMatrix[x][y]->setMeshSource("TD_T2.mesh"); 476 break; 477 478 case 2 : 479 towerModelMatrix[x][y]->setMeshSource("TD_T3.mesh"); 480 break; 481 case 3 : 482 towerModelMatrix[x][y]->setMeshSource("TD_T4.mesh"); 483 break; 484 case 4 : 485 towerModelMatrix[x][y]->setMeshSource("TD_T5.mesh"); 486 break; 487 488 } 489 int specificupgradecost = (int)(upgradeCost*(std::pow(1.5,towerTurretMatrix[x][y]->upgrade))); 490 if(this->credit_ >= specificupgradecost) 491 { 492 this->buyTower(specificupgradecost); 493 switch(towerTurretMatrix[x][y]->upgrade) 494 { 495 case 1 : 496 towerModelMatrix[x][y]->setMeshSource("TD_T2.mesh"); 497 break; 498 499 case 2 : 500 towerModelMatrix[x][y]->setMeshSource("TD_T3.mesh"); 501 break; 502 case 3 : 503 towerModelMatrix[x][y]->setMeshSource("TD_T4.mesh"); 504 break; 505 case 4 : 506 towerModelMatrix[x][y]->setMeshSource("TD_T5.mesh"); 507 break; 508 509 } 510 } 489 511 490 512 … … 501 523 502 524 503 int enemytype = this->getWaveNumber() % 3 +1; 525 504 526 505 527 506 528 if(time>=TowerDefenseEnemyvector.size() && TowerDefenseEnemyvector.size() < maxspaceships) 507 529 { 508 orxout() << "enemyerstellen" << endl; 530 509 531 //adds different types of enemys depending on the WaveNumber progressively making the combination of enemys more difficult 510 532 if(spaceships>0) -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.h
r10430 r10451 80 80 int ufos; 81 81 int randomships; 82 int maxspaceships = 30;83 82 84 83 -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefenseSelecter.cc
r10408 r10451 52 52 moveRightPressed_ = false; 53 53 firePressed_ = false; 54 setSelectedPosition( 0,0);54 setSelectedPosition(6,6); 55 55 timerSetFire_=0; 56 56 }
Note: See TracChangeset
for help on using the changeset viewer.