Changeset 11177 for code/branches/tgidronFS16/src/modules
- Timestamp:
- Apr 28, 2016, 4:04:42 PM (9 years ago)
- Location:
- code/branches/tgidronFS16/src/modules/hover
- Files:
-
- 2 added
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tgidronFS16/src/modules/hover/CMakeLists.txt
r11171 r11177 8 8 FlagHUD.cc 9 9 MazeGenerator.cc 10 FlagsAndLivesHUD.cc10 TFlagsLivesLevelHUD.cc 11 11 ) 12 12 -
code/branches/tgidronFS16/src/modules/hover/Hover.cc
r11171 r11177 121 121 122 122 123 //Generate 5 PickupSpawners randomly 123 //Generate 5 PickupSpawners randomly (destroy hover pickup) 124 124 for (int i = 0; i<5; i++) 125 125 { … … 134 134 pickupSpawners_.push_back(pickupSpawner); 135 135 } 136 //If no lives are left, end game 137 if(lives <= 0){ 138 GSLevel::startMainMenu(); 139 } 140 141 orxout() << this->origin_->getPickupTemplate() << endl; 142 orxout() << this->origin_->getPickupRepresentationTemplate() << endl; 143 } 144 } 145 146 147 // Rename/delete this function. 148 void Hover::startLevel() 149 { 150 //Generate 5 flags randomly (test only 1 flag) 151 for ( int i = 0; i < 5; i++ ) 152 { 153 HoverFlag* flag = new HoverFlag(origin_->getContext()); 154 flag->init(rand()%numCells, rand()%numCells, cellSize); 155 flags_.push_back(flag); 156 } 157 158 //Generate 5 PickupSpawners randomly 136 137 //Generate 5 PickupSpawners randomly (damage pickup) 159 138 for (int i = 0; i<5; i++) 160 139 { … … 162 141 163 142 pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f)); 164 pickupSpawner->setPickupTemplateName(origin_->getPickupTemplate ());143 pickupSpawner->setPickupTemplateName(origin_->getPickupTemplateDam()); 165 144 pickupSpawner->setMaxSpawnedItems(5); 166 145 pickupSpawner->setRespawnTime(30); … … 170 149 } 171 150 151 //***************************************************************************** 152 153 Pawn* crate = new Pawn(origin_->getContext()); 154 155 crate->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f)); 156 crate->addTemplate(origin_->getObstacleTemplate()); 157 158 159 160 161 //If no lives are left, end game 162 if(lives <= 0){ 163 GSLevel::startMainMenu(); 164 } 165 166 orxout() << this->origin_->getPickupTemplate() << endl; 167 orxout() << this->origin_->getPickupRepresentationTemplate() << endl; 168 169 orxout() << this->origin_->getPickupTemplateDam() << endl; 170 orxout() << this->origin_->getPickupRepresentationTemplateDam() << endl; 171 } 172 } 173 174 175 // Start new level 176 void Hover::newLevel() 177 { 178 //Generate 5 flags randomly (test only 1 flag) 179 for ( int i = 0; i < 5; i++ ) 180 { 181 HoverFlag* flag = new HoverFlag(origin_->getContext()); 182 flag->init(rand()%numCells, rand()%numCells, cellSize); 183 flags_.push_back(flag); 184 } 172 185 173 186 } … … 187 200 totFlags++; 188 201 if(flags_.size()<=0){ 189 ChatManager::message("Level Up!");202 //ChatManager::message("Level Up!"); 190 203 191 204 levelUp(); … … 205 218 { 206 219 level++; 207 startLevel(); 220 //increment lives after every 4 levels 221 if(level%4 == 0) 222 { 223 lives++; 224 } 225 newLevel(); 208 226 209 227 } -
code/branches/tgidronFS16/src/modules/hover/Hover.h
r11171 r11177 58 58 59 59 void start(); 60 void startLevel();60 void newLevel(); 61 61 void levelUp(); 62 62 void endLevel(); … … 73 73 inline int getLives() const 74 74 { return this->lives; } 75 76 inline int getLevel() const 77 { return this->level; } 75 78 76 79 private: -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc
r11169 r11177 48 48 pickupTemplate_ = ""; 49 49 pickupRepresentationTemplate_ = ""; 50 51 pickupTemplateDam_ = ""; 52 pickupRepresentationTemplateDam_ = ""; 50 53 } 51 54 … … 59 62 XMLPortParam(HoverOrigin, "pickuptemplate", setPickupTemplate, getPickupTemplate, xmlelement, mode); 60 63 XMLPortParam(HoverOrigin, "pickuprepresentationtemplate", setPickupRepresentationTemplate, getPickupRepresentationTemplate, xmlelement, mode); 64 XMLPortParam(HoverOrigin, "pickuptemplatedam", setPickupTemplateDam, getPickupTemplateDam, xmlelement, mode); 65 XMLPortParam(HoverOrigin, "pickuprepresentationtemplatedam", setPickupRepresentationTemplateDam, getPickupRepresentationTemplateDam, xmlelement, mode); 66 XMLPortParam(HoverOrigin, "obstacletemplate", setObstacleTemplate, getObstacleTemplate, xmlelement, mode); 61 67 } 68 62 69 63 70 void HoverOrigin::checkGametype() -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h
r11169 r11177 66 66 { return this->cellHeight_; } 67 67 68 //pickup template set and get for destroy hover pickup 69 68 70 inline void setPickupTemplate(std::string pickupTemplate) 69 71 { this->pickupTemplate_ = pickupTemplate; } … … 76 78 { return this->pickupRepresentationTemplate_; } 77 79 80 //pickup template get and set for damage hover pickup 81 82 inline void setPickupTemplateDam(std::string pickupTemplateDam) 83 { this->pickupTemplateDam_ = pickupTemplateDam; } 84 inline std::string getPickupTemplateDam() const 85 { return this->pickupTemplateDam_; } 86 87 inline void setPickupRepresentationTemplateDam(std::string pickupRepresenationaTemplateDam) 88 { this->pickupRepresentationTemplateDam_ = pickupRepresenationaTemplateDam; } 89 inline std::string getPickupRepresentationTemplateDam() const 90 { return this->pickupRepresentationTemplateDam_; } 91 92 //get and set for obstacle template 93 94 inline void setObstacleTemplate(std::string obstacleTemplate) 95 { this->obstacleTemplate_ = obstacleTemplate; } 96 inline std::string getObstacleTemplate() const 97 { return this->obstacleTemplate_; } 98 78 99 private: 79 100 void checkGametype(); 101 80 102 81 103 int numCells_; … … 86 108 std::string pickupTemplate_; 87 109 std::string pickupRepresentationTemplate_; 110 111 // Tempaltes for the damage hover pickup 112 std::string pickupTemplateDam_; 113 std::string pickupRepresentationTemplateDam_; 114 115 //Template for crate obstacle 116 std::string obstacleTemplate_; 88 117 }; 89 118 }
Note: See TracChangeset
for help on using the changeset viewer.