Changeset 10123 for code/branches
- Timestamp:
- Nov 12, 2014, 4:09:35 PM (10 years ago)
- Location:
- code/branches/towerdefenseHS14
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
r10109 r10123 129 129 orxout() << "test0" << endl; 130 130 131 131 132 Deathmatch::start(); 132 133 134 /* 133 135 const int kInitialTowerCount = 3; 134 136 … … 139 141 addTower(coordinate->x, coordinate->y); 140 142 } 143 */ 141 144 142 145 orxout() << "test3" << endl; … … 145 148 146 149 TDCoordinate* coord1 = new TDCoordinate(1,1); 147 /*TDCoordinate* coord2 = new TDCoordinate(10,10); 148 TDCoordinate* coord3 = new TDCoordinate(1,2);*/ 149 std::vector<TDCoordinate> path; 150 path.push_back(*coord1); 151 /*path.push_back(*coord2); 152 path.push_back(*coord3);*/ 153 154 for(int i = 0 ; i <4 ; ++i) 150 TDCoordinate* coord2 = new TDCoordinate(1,1); 151 TDCoordinate* coord3 = new TDCoordinate(1,2); 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) 155 166 { 156 167 addTowerDefenseEnemy(path); 157 168 } 158 169 170 orxout() << "test7" << endl; 171 159 172 //ChatManager::message("Use the console command addTower x y to add towers"); 160 173 … … 162 175 } 163 176 164 void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate > path){177 void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path){ 165 178 166 179 orxout() << "test1" << endl; 167 180 168 181 TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext()); 169 // Model* TowerDefenseEnemymodel = new Model(this->center_->getContext()); 170 //TowerDefenseEnemymodel->setMeshSource("crate.mesh"); 171 //TowerDefenseEnemymodel->setPosition(0,0,0); 172 en1->setPosition(path.at(0).get3dcoordinate()); 173 //TowerDefenseEnemymodel->setScale(0.2); 174 175 //en1->attach(TowerDefenseEnemymodel); 176 177 //TowerDefenseEnemyvector.push_back(en1); 182 en1->addTemplate("spaceshipassff"); 183 /*en1->setInitialHealth(1000); 184 en1->setHealth(1000); 185 en1->setMaxHealth(1000); 186 en1->setInitialShieldHealth(1000); 187 en1->setShieldHealth(1000); 188 en1->setMaxShieldHealth(1000);*/ 189 orxout() << "en1 " << en1->getHealth() << endl; 190 191 192 Model* TowerDefenseEnemymodel = new Model(this->center_->getContext()); 193 194 TowerDefenseEnemymodel->setMeshSource("cube.mesh"); 195 196 TowerDefenseEnemymodel->setPosition(0,0,75); 197 en1->setPosition(0,0,150); 198 TowerDefenseEnemymodel->setScale(10); 199 200 201 en1->attach(TowerDefenseEnemymodel); 202 203 TowerDefenseEnemyvector.push_back(en1); 178 204 179 205 orxout() << "test2" << endl; 180 206 181 /*for(unsigned int i = 0; i < path.size(); ++i) 182 { 183 en1->addWaypoint(path.at(i)); 207 for(unsigned int i = 0; i < path.size(); ++i) 208 { 209 en1->addWaypoint((path.at(i))); 210 } 211 orxout() << "test6" << endl; 212 213 214 /* for (int i = 0; i < TowerDefenseEnemyvector.size(); ++i ) 215 { 216 orxout() <<i << " " << TowerDefenseEnemyvector.at(i)->getHealth() << endl; 217 } 218 219 WaypointController *newController = new WaypointController(en1->getContext());// 220 newController->setAccuracy(3); 221 222 for(int i =0; i < path.size(); ++i) 223 { 224 225 Model *wayPoint = new Model(en1->getContext()); 226 wayPoint->setMeshSource("cube.mesh"); 227 wayPoint->setPosition(path.at(i)->get3dcoordinate()); 228 wayPoint->setScale(0.2); 229 newController->addWaypoint(wayPoint); 184 230 }*/ 185 186 orxout() << "test6" << endl;187 188 /*WaypointController *newController = new WaypointController(en1);189 newController->setAccuracy(3);190 191 for(int i =0; i < path.size(); ++i)192 {193 194 Model *wayPoint = new Model(newController);195 wayPoint->setMeshSource("crate.mesh");196 wayPoint->setPosition(path.at(i).get3dcoordinate());197 wayPoint->setScale(0.2);198 199 newController->addWaypoint(wayPoint);200 201 }*/202 203 231 } 204 232 205 233 206 234 void TowerDefense::end() 235 207 236 { 208 237 Deathmatch::end(); … … 214 243 215 244 void TowerDefense::addTower(int x, int y) 216 { 217 /*const TowerCost towerCost = TDDefaultTowerCost;245 {/* 246 const TowerCost towerCost = TDDefaultTowerCost; 218 247 219 248 if (!this->hasEnoughCreditForTower(towerCost)) … … 284 313 void TowerDefense::tick(float dt) 285 314 { 286 //SUPER(TowerDefense, tick, dt); 315 SUPER(TowerDefense, tick, dt); 316 317 /* for (int i = 0; i < TowerDefenseEnemyvector.size(); ++i ) 318 { 319 orxout() <<i << " " << TowerDefenseEnemyvector.at(i)->getHealth() << endl; 320 } 321 */ 322 287 323 } 288 324 -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
r10109 r10123 56 56 std::vector<TowerDefenseEnemy*> TowerDefenseEnemyvector; 57 57 58 void addTowerDefenseEnemy(std::vector<TDCoordinate > path);58 void addTowerDefenseEnemy(std::vector<TDCoordinate*> path); 59 59 virtual void start(); //<! The function is called when the gametype starts 60 60 virtual void end(); -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
r10109 r10123 32 32 } 33 33 34 void TowerDefenseEnemy::addWaypoint(TDCoordinate coord)34 void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord) 35 35 { 36 36 orxout() << "test4" << endl; … … 38 38 orxout() << "test5" << endl; 39 39 } 40 40 /* 41 41 void TowerDefenseEnemy::popWaypoint() 42 42 { … … 48 48 { 49 49 if(Waypointsvector_.size()<=0){ 50 TDCoordinate coord = TDCoordinate(-1,-1);50 TDCoordinate* coord = TDCoordinate(-1,-1); 51 51 return coord; 52 52 }else{ … … 57 57 58 58 } 59 59 */ 60 60 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.h
r10109 r10123 38 38 //health gibt es unter: health_ 39 39 40 void addWaypoint(TDCoordinate coord);40 void addWaypoint(TDCoordinate* coord); 41 41 void popWaypoint(); 42 42 TDCoordinate peekWaypoint(); 43 43 private: 44 44 45 std::vector<TDCoordinate > Waypointsvector_;45 std::vector<TDCoordinate*> Waypointsvector_; 46 46 47 47 };
Note: See TracChangeset
for help on using the changeset viewer.