Changeset 10340
- Timestamp:
- Apr 2, 2015, 3:57:34 PM (10 years ago)
- Location:
- code/branches/towerdefenseFS15
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFS15/data/levels/templates/towerdefensetower.oxt
r10335 r10340 23 23 </controller> 24 24 25 26 <attached>27 28 <!--Turret29 30 explosionchunks = 631 reloadrate=1032 reloadwaittime=533 collisionType="none"34 maxPitch=9035 maxYaw=9036 maxAttackRadius=100037 minAttackRadius=3038 team = 139 >40 41 <controller>42 <TurretController/>43 </controller>44 45 46 </Turret-->47 </attached>48 25 49 26 -
code/branches/towerdefenseFS15/src/modules/objects/Turret.cc
r10262 r10340 223 223 XMLPortParam(Turret, "maxYaw", setMaxYaw, getMaxYaw, xmlelement, mode); 224 224 XMLPortParam(Turret, "maxPitch", setMaxPitch, getMaxPitch, xmlelement, mode); 225 XMLPortParam(Turret, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode); 225 226 } 226 227 -
code/branches/towerdefenseFS15/src/modules/objects/Turret.h
r10262 r10340 102 102 { return this->maxYaw_; } 103 103 104 inline void setRotationThrust(float rotationthrust) 105 { this->rotationThrust_ = rotationthrust; } 106 107 inline float getRotationThrust() 108 { return this->rotationThrust_; } 109 104 110 protected: 105 111 Vector3 startDir_; //!< The initial facing direction, in local coordinates. -
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(); -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefense.h
r10258 r10340 53 53 54 54 std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector; 55 bool towermatrix[16][16]; 55 Model* towerModelMatrix[16][16]; 56 TowerDefenseTower* towerTurretMatrix[16][16]; 56 57 void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr); 57 58 virtual void start(); //<! The function is called when the gametype starts -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefenseEnemy.cc
r10258 r10340 35 35 //add credit if enemy is destroyed 36 36 TowerDefenseEnemy::~TowerDefenseEnemy(){ 37 //this->td->addCredit(1); 37 38 if (this->isInitialized()) 39 { 40 getGame()->addCredit(1); 41 } 38 42 } 39 43 … … 64 68 if (getGame() && once_ == false && getHealth() <= 0) 65 69 { 70 orxout() << "damagefunctionIF" << endl; 66 71 getGame()->addCredit(1); 67 72 once_ = true; 68 73 } 74 orxout() << "damagefunction" << endl; 75 69 76 } 77 70 78 /* 71 79 void TowerDefenseEnemy::popWaypoint() -
code/branches/towerdefenseFS15/src/modules/towerdefense/TowerDefenseTower.cc
r10335 r10340 66 66 float reloadrate = getReloadRate(); 67 67 float reloadwaittime = getReloadWaitTime(); 68 this->setDamageMultiplier( 5000);69 68 this->setDamageMultiplier((upgrade+1)*2); 69 this->setRotationThrust(2*this->getRotationThrust()); 70 70 reloadrate = 0.5f*reloadrate; 71 71 reloadwaittime = 0.5f*reloadwaittime;
Note: See TracChangeset
for help on using the changeset viewer.