- Timestamp:
- Apr 2, 2015, 3:57:34 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.cc
r10335 r10340 102 102 }*/ 103 103 104 105 104 106 this->setHUDTemplate("TowerDefenseHUD"); 105 107 … … 136 138 for (int i=0; i < 16 ; i++){ 137 139 for (int j = 0; j< 16 ; j++){ 138 towermatrix[i][j] = false; 139 } 140 } 140 towerModelMatrix[i][j] = NULL; 141 towerTurretMatrix[i][j] = NULL; 142 } 143 } 144 145 Model* dummyModel = new Model(this->center_->getContext()); 141 146 142 147 //the path of the spacehips has to be blocked, so that no towers can be build there 143 148 for (int k=0; k<3; k++) 144 tower matrix[1][k]=true;149 towerModelMatrix[1][k]=dummyModel; 145 150 for (int l=1; l<11; l++) 146 towermatrix[l][3]=true;151 towerModelMatrix[l][3]=dummyModel; 147 152 for (int m=3; m<12; m++) 148 towermatrix[10][m]=true;153 towerModelMatrix[10][m]=dummyModel; 149 154 for (int n=10; n<14; n++) 150 towermatrix[n][11]=true;155 towerModelMatrix[n][11]=dummyModel; 151 156 for (int o=13; o<16; o++) 152 towermatrix[13][o]=true; 157 towerModelMatrix[13][o]=dummyModel; 158 153 159 154 160 //set initial credits, lifes and WaveNumber … … 158 164 time=0.0; 159 165 166 /* 160 167 //adds initial towers 161 /*162 168 for (int i=0; i <7; i++){ 163 169 addTower(i+3,4); 164 170 } 165 171 */ 166 172 } 167 173 … … 216 222 //not working yet 217 223 void TowerDefense::upgradeTower(int x,int y) 218 { /*224 { 219 225 const int upgradeCost = 20; 220 226 … … 225 231 } 226 232 227 if (towermatrix [x][y] == NULL) 233 234 Model* dummyModel2 = new Model(this->center_->getContext()); 235 236 if (towerModelMatrix [x][y] == NULL || (towerModelMatrix [x][y])->getMeshSource() == dummyModel2->getMeshSource()) 228 237 { 229 238 orxout() << "no tower on this position" << endl; … … 233 242 else 234 243 { 235 (towermatrix [x][y])->upgradeTower(); 236 }*/ 244 (towerTurretMatrix [x][y])->upgradeTower(); 245 this->buyTower(upgradeCost); 246 } 237 247 } 238 248 … … 251 261 } 252 262 253 if (tower matrix [x][y]==true)263 if (towerModelMatrix [x][y]!=NULL) 254 264 { 255 265 orxout() << "not possible to put tower here!!" << endl; … … 273 283 orxout() << "Will add tower at (" << (x-8) * tileScale << "," << (y-8) * tileScale << ")" << endl; 274 284 275 //Reduce credit 276 this->buyTower(towerCost); 277 towermatrix [x][y]=true; 285 278 286 279 287 //Create Model … … 290 298 towernew->setGame(this); 291 299 towernew->setTeam(1); 300 301 //Reduce credit 302 this->buyTower(towerCost); 303 towerModelMatrix [x][y]= newtowermodel; 304 towerTurretMatrix [x][y]= towernew; 292 305 } 293 306 … … 325 338 if(TowerDefenseEnemyvector.at(i) != NULL && TowerDefenseEnemyvector.at(i)->isAlive()) 326 339 { 327 //destroys enemys at the end of t ehpath and reduces the life by 1. no credits gifted340 //destroys enemys at the end of the path and reduces the life by 1. no credits gifted 328 341 329 342 Vector3 ship = TowerDefenseEnemyvector.at(i)->getRVWorldPosition();
Note: See TracChangeset
for help on using the changeset viewer.