Changeset 10140 for code/branches
- Timestamp:
- Nov 26, 2014, 4:30:10 PM (10 years ago)
- Location:
- code/branches/towerdefenseHS14
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseHS14/data/levels/templates/tower.oxt
r9348 r10140 9 9 10 10 collisionType = "dynamic" 11 team = 211 team = 0 12 12 13 13 -
code/branches/towerdefenseHS14/data/levels/towerDefense.oxw
r10134 r10140 21 21 include("templates/spaceshipPirate.oxt") 22 22 include("templates/tower.oxt") 23 include("templates/enemy towerdefense.oxt")23 include("templates/enemyTowerdefense.oxt") 24 24 ?> 25 25 -
code/branches/towerdefenseHS14/data/overlays/towerdefenseHUD.oxo
r9348 r10140 1 1 <Template name="TowerDefenseHUD"> 2 3 2 4 <OverlayGroup name="TowerDefenseHUD" scale = "1, 1"> 5 6 3 7 <OverlayText 4 position = "0. 05, 0.05"8 position = "0.83, 0.05" 5 9 pickpoint = "0.0, 0.0" 6 10 font = "ShareTechMono" … … 9 13 align = "left" 10 14 11 caption = " Hello World"15 caption = "Cash:" 12 16 /> 17 18 19 <TowerDefenseHUDController 20 position = "0.88, 0.10" 21 pickpoint = "0.0, 0.0" 22 font = "ShareTechMono" 23 textsize = 0.05 24 colour = "1.0, 1.0, 1.0, 1.0" 25 align = "left" 26 showlives = false 27 showcredits = true 28 showwaves = false 29 /> 30 31 <OverlayText 32 position = "0.83, 0.22" 33 pickpoint = "0.0, 0.0" 34 font = "ShareTechMono" 35 textsize = 0.05 36 colour = "1.0, 1.0, 1.0, 1.0" 37 align = "left" 38 39 caption = "Lives:" 40 /> 41 42 <TowerDefenseHUDController 43 position = "0.88, 0.27" 44 pickpoint = "0.0, 0.0" 45 font = "ShareTechMono" 46 textsize = 0.05 47 colour = "1.0, 1.0, 1.0, 1.0" 48 align = "left" 49 showlives = true 50 showcredits = false 51 showwaves = false 52 /> 53 54 <OverlayText 55 position = "0.83, 0.39" 56 pickpoint = "0.0, 0.0" 57 font = "ShareTechMono" 58 textsize = 0.05 59 colour = "1.0, 1.0, 1.0, 1.0" 60 align = "left" 61 62 caption = "Waves:" 63 /> 64 65 <TowerDefenseHUDController 66 position = "0.88, 0.44" 67 pickpoint = "0.0, 0.0" 68 font = "ShareTechMono" 69 textsize = 0.05 70 colour = "1.0, 1.0, 1.0, 1.0" 71 align = "left" 72 showlives = false 73 showcredits = false 74 showwaves = true 75 76 /> 77 78 13 79 </OverlayGroup> 14 80 </Template> 81 82 -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.cc
r10134 r10140 130 130 131 131 Deathmatch::start(); 132 132 credits = 5000; 133 life = 20; 134 waves = 0; 133 135 time=0.0; 134 136 … … 158 160 // Generates a TowerDefenseEnemy. Uses Template "enemytowerdefense". Sets position at first waypoint of path. 159 161 160 void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path , int templatenr){162 void TowerDefense::addTowerDefenseEnemy(std::vector<TDCoordinate*> path){ 161 163 162 164 TowerDefenseEnemy* en1 = new TowerDefenseEnemy(this->center_->getContext()); 163 164 switch(templatenr) 165 { 166 case 1 : 167 en1->addTemplate("enemytowerdefense1"); 168 en1->setScale(3); 169 break; 170 case 2 : 171 en1->addTemplate("enemytowerdefense2"); 172 en1->setScale(2); 173 break; 174 case 3 : 175 en1->addTemplate("enemytowerdefense3"); 176 en1->setScale(1); 177 break; 178 } 179 165 en1->addTemplate("enemytowerdefense"); 166 en1->setScale(3); 180 167 en1->getController(); 181 168 … … 298 285 if(time>1 && TowerDefenseEnemyvector.size() < 30) 299 286 { 300 301 addTowerDefenseEnemy(path, rand() %3 +1 ); 287 addTowerDefenseEnemy(path); 302 288 time = time-1; 303 289 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefense.h
r10134 r10140 56 56 std::vector<TowerDefenseEnemy*> TowerDefenseEnemyvector; 57 57 58 void addTowerDefenseEnemy(std::vector<TDCoordinate*> path , int templatenr);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(); … … 63 63 //virtual bool playerLeft(PlayerInfo* player); 64 64 65 int credits; 66 int life; 67 int waves; 65 68 //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 66 69 //virtual void playerScored(PlayerInfo* player, int score); -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseEnemy.cc
r10134 r10140 48 48 float distance = ship.distance(*endpoint); 49 49 50 orxout() << "distance" << distance << endl; 50 51 if(distance <50){ 52 orxout() << "ENEMY KILLED!!!!" << endl; 51 53 this->destroy(); } 52 54 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.cc
r9667 r10140 32 32 #include "util/Convert.h" 33 33 34 35 34 namespace orxonox 36 35 { … … 50 49 { 51 50 SUPER(TowerDefenseHUDController, tick, dt); 51 52 if(showlives == true) 53 this->setCaption(multi_cast<std::string>(this->td->life)); 54 else if(showcredits == true) 55 this->setCaption(multi_cast<std::string>(this->td->credits)); 56 else if(showwaves == true) 57 this->setCaption(multi_cast<std::string>(this->td->waves)); 58 59 52 60 } 53 61 … … 55 63 { 56 64 SUPER(TowerDefenseHUDController, XMLPort, xmlelement, mode); 65 66 XMLPortParam(TowerDefenseHUDController, "showlives", setShowlives, getShowlives, xmlelement, mode); 67 XMLPortParam(TowerDefenseHUDController, "showcredits", setShowcredits, getShowcredits, xmlelement, mode); 68 XMLPortParam(TowerDefenseHUDController, "showwaves", setShowwaves, getShowwaves, xmlelement, mode); 69 57 70 } 58 71 59 72 void TowerDefenseHUDController::changedOwner() 60 { 61 SUPER(TowerDefenseHUDController, changedOwner); 62 /* 63 if (this->getOwner() != NULL && this->getOwner()->getGametype()) 64 this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get()); 65 else 66 this->owner_ = 0; 67 */ 68 } 73 { 74 SUPER(TowerDefenseHUDController, changedOwner); 75 76 td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get()); 77 78 /*if (this->getOwner() != NULL && this->getOwner()->getGametype()) 79 { 80 this->owner_ = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get()); 81 } 82 else 83 { 84 this->owner_ = NULL; 85 }*/ 86 } 69 87 70 88 } -
code/branches/towerdefenseHS14/src/modules/towerdefense/TowerDefenseHUDController.h
r9667 r10140 42 42 #include "tools/interfaces/Tickable.h" 43 43 #include "overlays/OverlayText.h" 44 44 #include "TowerDefense.h" 45 45 46 46 namespace orxonox … … 52 52 virtual ~TowerDefenseHUDController(); 53 53 54 54 55 virtual void tick(float dt); 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 56 57 virtual void changedOwner(); 58 void setShowlives(bool temp) 59 { this->showlives = temp; } 60 unsigned int getShowlives(void) const 61 { return this->showlives; } 62 63 void setShowcredits(bool temp) 64 { this->showcredits = temp; } 65 unsigned int getShowcredits(void) const 66 { return this->showcredits; } 67 68 void setShowwaves(bool temp) 69 { this->showwaves = temp; } 70 unsigned int getShowwaves(void) const 71 { return this->showwaves; } 72 73 private: 74 TowerDefense* td; 75 76 bool showcredits; 77 bool showlives; 78 bool showwaves; 57 79 }; 58 80 }
Note: See TracChangeset
for help on using the changeset viewer.