Changeset 10408 for code/branches/towerdefenseFS15/src/modules
- Timestamp:
- Apr 30, 2015, 4:07:53 PM (10 years ago)
- Location:
- code/branches/towerdefenseFS15/src/modules/towerdefense
- Files:
-
- 5 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); -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.h
r10406 r10408 99 99 PlayerInfo* player_; 100 100 float time; 101 float timeSetTower_; 101 102 // float time2; 102 103 int credit_; -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefenseSelecter.cc
r10406 r10408 51 51 moveLeftPressed_ = false; 52 52 moveRightPressed_ = false; 53 setSelectedPosition(0,0); 53 firePressed_ = false; 54 setSelectedPosition(0,0); 55 timerSetFire_=0; 54 56 } 55 57 … … 68 70 SUPER(TowerDefenseSelecter, tick, dt); 69 71 72 70 73 if (hasLocalController()) 71 74 { 72 int selecterPosX = selectedPos_->GetX(); 73 int selecterPosY = selectedPos_->GetY(); 75 timerSetFire_ +=dt; 74 76 75 if (moveUpPressed_ == true) 76 { 77 selectedPos_->Set(selecterPosX, selecterPosY + 1); 78 updatePosition(); 79 orxout() << "up" << endl; 80 } 81 if (moveDownPressed_ == true) 82 { 83 selectedPos_->Set(selecterPosX, selecterPosY - 1); 84 updatePosition(); 85 orxout() << "Down" << endl; 86 } 77 if(timerSetFire_ >= 0.25) 78 { 79 timerSetFire_ = 0; 87 80 88 if (moveLeftPressed_ == true) 89 { 90 selectedPos_->Set(selecterPosX - 1, selecterPosY); 91 updatePosition(); 92 orxout() << "Left" << endl; 93 } 94 if (moveRightPressed_ == true) 95 { 96 selectedPos_->Set(selecterPosX + 1, selecterPosY); 97 updatePosition(); 98 orxout() << "Right" << endl; 99 } 81 int selecterPosX = selectedPos_->GetX(); 82 int selecterPosY = selectedPos_->GetY(); 100 83 101 /* 102 if (firePressed_ && timeSinceLastFire_ >= maxFireRate_) 103 { 104 firePressed_ = false; 105 timeSinceLastFire_ = 0.0; 106 } 107 */ 84 if (moveUpPressed_ == true) 85 { 86 moveUpPressed_ = false; 87 selectedPos_->Set(selecterPosX, selecterPosY + 1); 88 updatePosition(); 89 } 90 if (moveDownPressed_ == true) 91 { 92 moveDownPressed_ = false; 93 selectedPos_->Set(selecterPosX, selecterPosY - 1); 94 updatePosition(); 95 } 96 97 if (moveLeftPressed_ == true) 98 { 99 moveLeftPressed_ = false; 100 selectedPos_->Set(selecterPosX - 1, selecterPosY); 101 updatePosition(); 102 } 103 if (moveRightPressed_ == true) 104 { 105 moveRightPressed_ = false; 106 selectedPos_->Set(selecterPosX + 1, selecterPosY); 107 updatePosition(); 108 } 109 110 111 } 112 113 114 108 115 } 109 110 // Reset key variables 111 moveUpPressed_ = false; 112 moveDownPressed_ = false; 113 moveLeftPressed_ = false; 114 moveRightPressed_ = false; 115 //firePressed_ = false; 116 } 116 } 117 117 118 118 … … 157 157 } 158 158 159 void TowerDefenseSelecter::fire(unsigned int firemode) 159 160 void TowerDefenseSelecter::boost(bool bBoost) 160 161 { 162 firePressed_ = true; 163 orxout() << "boost" << endl; 161 164 } 162 165 163 void TowerDefenseSelecter::fired(unsigned int firemode)164 {165 //firePressed_ = true;166 }167 166 168 167 void TowerDefenseSelecter::updatePosition() -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefenseSelecter.h
r10406 r10408 48 48 virtual void rotatePitch(const Vector2& value); 49 49 virtual void rotateRoll(const Vector2& value); 50 void fire(unsigned int firemode); 51 virtual void fired(unsigned int firemode); 50 virtual void boost(bool bBoost); 52 51 virtual void setSelectedPosition(TDCoordinate* newPos); 53 52 virtual void setSelectedPosition(int x, int y); 53 bool firePressed_; 54 TDCoordinate* selectedPos_; 55 54 56 55 57 private: 56 58 virtual void updatePosition(); 57 58 TDCoordinate* selectedPos_; 59 float timerSetFire_; 59 60 bool moveUpPressed_; 60 61 bool moveDownPressed_; -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefenseTower.cc
r10340 r10408 66 66 float reloadrate = getReloadRate(); 67 67 float reloadwaittime = getReloadWaitTime(); 68 this->setDamageMultiplier((upgrade+1)* 2);68 this->setDamageMultiplier((upgrade+1)*1.5); 69 69 this->setRotationThrust(2*this->getRotationThrust()); 70 reloadrate = 0. 5f*reloadrate;71 reloadwaittime = 0. 5f*reloadwaittime;70 reloadrate = 0.7f*reloadrate; 71 reloadwaittime = 0.7f*reloadwaittime; 72 72 setReloadRate(reloadrate); 73 73 setReloadWaitTime(reloadwaittime);
Note: See TracChangeset
for help on using the changeset viewer.