Changeset 10132 for code/branches/towerdefenseHS14
- Timestamp:
- Nov 19, 2014, 4:20:18 PM (10 years ago)
- Location:
- code/branches/towerdefenseHS14
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/data/levels/templates/enemyTowerdefense.oxt
r10126 r10132 62 62 <waypoints> 63 63 <!-- 1,3 10,3 10,11, 13,11 --> 64 <Model mesh="cube.mesh" scale=10 position="-700,-500, 150" /> 65 <Model mesh="cube.mesh" scale=10 position=" -400,-500, 150" /> 66 <Model position=" -400, 600, 150" /> 67 <Model mesh="cube.mesh" scale=10 position=" 500, 600, 150" /> 68 <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" /> 64 65 <Model position="-700,-500, 150" /> 66 <Model position=" 200,-500, 150" /> 67 68 <Model position=" 200, 300, 150" /> 69 <Model position=" 500, 300, 150" /> 70 <!-- <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" /> --> 71 <Model position=" 500, 700, 150" /> 72 69 73 </waypoints> 70 74 </WaypointController> -
code/branches/towerdefenseHS14/data/levels/towerDefense.oxw
r10126 r10132 77 77 <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /--> 78 78 79 <TowerDefenseEnemy position="-700,-500, 100" lookat="0,0,0" scale=3 team=1 > 80 <templates> 81 <Template link=enemytowerdefense /> 82 </templates> 83 <controller> 84 <WaypointController accuracy=60> 85 <waypoints> 86 <!-- 1,3 10,3 10,11, 13,11 --> 87 <Model mesh="cube.mesh" scale=10 position="-700,-500, 150" /> 88 <Model mesh="cube.mesh" scale=10 position=" 200,-500, 150" /> 89 <Model mesh="cube.mesh" scale=10 position=" 200, 300, 150" /> 90 <Model mesh="cube.mesh" scale=10 position=" 500, 300, 150" /> 91 <Model mesh="cube.mesh" scale=10 position=" 500, 700, 150" /> 92 </waypoints> 93 </WaypointController> 94 </controller> 95 </TowerDefenseEnemy> 79 96 80 97 81 -
code/branches/towerdefenseHS14/src/modules/towerdefense/Tower.cc
r10091 r10132 40 40 { 41 41 static int ori; 42 orxout() << "orientation " << ++ori << endl;42 //orxout() << "orientation " << ++ori << endl; 43 43 } 44 44 … … 58 58 { 59 59 static int roll; 60 orxout() << "rotateRoll" << ++roll << endl;60 //orxout() << "rotateRoll" << ++roll << endl; 61 61 } 62 62 -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
r10126 r10132 129 129 orxout() << "test0" << endl; 130 130 131 132 131 Deathmatch::start(); 132 133 time=0.0; 133 134 134 135 /* … … 143 144 */ 144 145 145 orxout() << "test3" << endl;146 146 147 147 //add some TowerDefenseEnemys 148 148 149 TDCoordinate* coord1 = new TDCoordinate(1,1); 150 TDCoordinate* coord2 = new TDCoordinate(1,3); 151 TDCoordinate* coord3 = new TDCoordinate(10,3); 152 153 154 std::vector<TDCoordinate*> path; 155 156 157 path.push_back(coord1); 158 159 path.push_back(coord2); 160 161 path.push_back(coord3); 162 163 164 165 for(int i = 0 ; i < 20 ; ++i) 166 { 167 addTowerDefenseEnemy(path); 168 } 169 170 orxout() << "test7" << endl; 149 150 151 171 152 172 153 //ChatManager::message("Use the console command addTower x y to add towers"); … … 178 159 179 160 void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path){ 180 181 orxout() << "test1" << endl;182 161 183 162 TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext()); … … 186 165 en1->getController(); 187 166 188 189 /*en1->setInitialHealth(1000);190 en1->setHealth(1000);191 en1->setMaxHealth(1000);192 en1->setInitialShieldHealth(1000);193 en1->setShieldHealth(1000);194 en1->setMaxShieldHealth(1000);*/195 orxout() << "en1 " << en1->getHealth() << endl;196 197 198 //Model* TowerDefenseEnemymodel = new Model(this->center_->getContext());199 200 //TowerDefenseEnemymodel->setMeshSource("cube.mesh");201 202 //TowerDefenseEnemymodel->setPosition(0,0,75);203 167 en1->setPosition(path.at(0)->get3dcoordinate()); 204 168 205 //TowerDefenseEnemymodel->setScale(10);206 207 208 //en1->attach(TowerDefenseEnemymodel);209 169 210 170 TowerDefenseEnemyvector.push_back(en1); 211 171 212 orxout() << "test2" << endl;213 172 214 173 for(unsigned int i = 0; i < path.size(); ++i) … … 216 175 en1->addWaypoint((path.at(i))); 217 176 } 218 orxout() << "test6" << endl; 219 220 221 /* for (int i = 0; i < TowerDefenseEnemyvector.size(); ++i ) 222 { 223 orxout() <<i << " " << TowerDefenseEnemyvector.at(i)->getHealth() << endl; 224 } 225 177 178 179 /* 226 180 WaypointController *newController = new WaypointController(en1->getContext());// 227 181 newController->setAccuracy(3); … … 321 275 { 322 276 SUPER(TowerDefense, tick, dt); 323 324 /* for (int i = 0; i < TowerDefenseEnemyvector.size(); ++i ) 325 { 326 orxout() <<i << " " << TowerDefenseEnemyvector.at(i)->getHealth() << endl; 327 } 328 */ 277 time +=dt; 278 279 TDCoordinate* coord1 = new TDCoordinate(1,1); 280 std::vector<TDCoordinate*> path; 281 path.push_back(coord1); 282 283 if(time>1 && TowerDefenseEnemyvector.size() < 30) 284 { 285 addTowerDefenseEnemy(path); 286 time = time-1; 287 } 288 329 289 330 290 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
r10123 r10132 85 85 private: 86 86 TowerDefenseCenterpoint *center_; 87 float time; 87 88 88 89 /* handles stats */ -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseController.cc
r10091 r10132 33 33 #include "core/XMLPort.h" 34 34 #include "worldentities/pawns/Pawn.h" 35 #include "controllers/WaypointController.h" 35 36 36 37 namespace orxonox -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
r10126 r10132 34 34 void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord) 35 35 { 36 orxout() << "test4" << endl;37 36 this->Waypointsvector_.push_back(coord); 38 orxout() << "test5" << endl;39 37 } 38 39 40 void TowerDefenseEnemy::tick(float dt) 41 { 42 SUPER(TowerDefenseEnemy, tick, dt); 43 44 //ArtificialController* controller = (ArtificialController*)this->getController(); 45 Vector3 ship = this->getRVWorldPosition(); 46 Vector3* endpoint = new Vector3(500, 700, 150); 47 48 float distance = ship.distance(*endpoint); 49 50 orxout() << "distance" << distance << endl; 51 if(distance <50){ 52 orxout() << "ENEMY KILLED!!!!" << endl; 53 this->destroy(); } 54 } 55 40 56 /* 41 57 void TowerDefenseEnemy::popWaypoint() -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.h
r10126 r10132 22 22 #include "worldentities/pawns/SpaceShip.h" 23 23 #include "util/Output.h" 24 #include "controllers/ArtificialController.h" 24 25 25 26 namespace orxonox … … 38 39 //health gibt es unter: health_ 39 40 41 virtual void tick(float dt); 40 42 void addWaypoint(TDCoordinate* coord); 41 43 void popWaypoint();
Note: See TracChangeset
for help on using the changeset viewer.