- Timestamp:
- Dec 5, 2014, 4:27:06 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
r10158 r10159 102 102 this->setHUDTemplate("TowerDefenseHUD"); 103 103 104 this->stats_ = new TowerDefensePlayerStats();104 //this->stats_ = new TowerDefensePlayerStats(); 105 105 106 106 /* Temporary hack to allow the player to add towers */ … … 131 131 132 132 Deathmatch::start(); 133 credits = 5000;133 /*credits = 5000; 134 134 life = 20; 135 135 waves = 0; 136 time=0.0; 136 time=0.0;*/ 137 137 138 138 // Waypoints: [1,3] [10,3] [10,11] [13,11] … … 154 154 155 155 156 credits = 5000;157 life = 20;158 waves = 0;156 this->setCredit(200); 157 this->setLifes(10); 158 this->setWaveNumber(0); 159 159 time=0.0; 160 160 … … 236 236 Deathmatch::end(); 237 237 238 ChatManager::message("Match is over ");238 ChatManager::message("Match is over! Gameover!"); 239 239 } 240 240 241 241 void TowerDefense::upgradeTower(int x,int y) 242 { 243 const TowerCost upgra eCost = TDDefaultUpgradeCost;244 245 if (!this->hasEnoughCreditForTower(upgra eCost))246 { 247 orxout() << "not enough credit: " << (this-> stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed.";242 {/* 243 const TowerCost upgradeCost = TDDefaultUpgradeCost; 244 245 if (!this->hasEnoughCreditForTower(upgradeCost)) 246 { 247 orxout() << "not enough credit: " << (this->getCredit()) << " available, " << upgradeCost << " needed."; 248 248 return; 249 249 } … … 258 258 { 259 259 (towermatrix [x][y])->upgradeTower(); 260 } 260 }*/ 261 261 } 262 262 … … 264 264 void TowerDefense::addTower(int x, int y) 265 265 { 266 const TowerCost towerCost = TDDefaultTowerCost;266 const int towerCost = 20; 267 267 268 268 if (!this->hasEnoughCreditForTower(towerCost)) 269 269 { 270 orxout() << "not enough credit: " << (this-> stats_->getCredit()) << " available, " << TDDefaultTowerCost << " needed.";270 orxout() << "not enough credit: " << (this->getCredit()) << " available, " << towerCost << " needed."; 271 271 return; 272 272 } … … 278 278 } 279 279 280 280 /* 281 281 unsigned int width = this->center_->getWidth(); 282 282 unsigned int height = this->center_->getHeight(); 283 283 */ 284 284 285 285 int tileScale = (int) this->center_->getTileScale(); … … 297 297 298 298 //Reduce credit 299 this->stats_->buyTower(towerCost); 300 301 orxout() << "Credit: " << this->stats_->getCredit() << endl; 299 this->buyTower(towerCost); 300 301 towermatrix [x][y]=true; 302 302 303 303 304 // Create tower … … 307 308 towernew->setGame(this); 308 309 309 towermatrix[x][y]=true; 310 } 311 312 bool TowerDefense::hasEnoughCreditForTower(TowerCost towerCost) 313 { 314 return ((this->stats_->getCredit()) >= towerCost); 310 } 311 312 bool TowerDefense::hasEnoughCreditForTower(int towerCost) 313 { 314 return ((this->getCredit()) >= towerCost); 315 315 } 316 316
Note: See TracChangeset
for help on using the changeset viewer.