Changeset 11196 for code/branches/tgidronFS16/src/modules
- Timestamp:
- May 26, 2016, 2:49:44 PM (9 years ago)
- Location:
- code/branches/tgidronFS16/src/modules/hover
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tgidronFS16/src/modules/hover/Hover.cc
r11192 r11196 24 24 * Co-authors: 25 25 * Cyrill Burgener 26 * Tomer Gidron 26 27 * 27 28 */ … … 64 65 cellHeight = 0; 65 66 66 b ShowLevel= false;67 bLevelUpgradeHUD = false; 67 68 68 69 totFlags = 0; … … 83 84 cellHeight = this->origin_->getCellHeight(); 84 85 85 /* 86 bool occupiedCells[numCells][numCells]; 87 88 for(int i = 0; i < numCells; i++) 89 { 90 for(int j = 0; j < numCells; j++) 91 { 92 occupiedCells[i][j] = false; 93 } 94 } 95 occupiedCells[0][0] = true; 96 */ 86 //TODO 87 //create boolean array/vector to assert that no two objects are placed in the same way 88 97 89 98 90 MazeGenerator generator(numCells); … … 205 197 GSLevel::startMainMenu(); 206 198 } 207 // Debug 208 orxout() << this->origin_->getPickupTemplate() << endl; 209 orxout() << this->origin_->getPickupRepresentationTemplate() << endl; 210 211 212 orxout() << this->origin_->getPickupTemplateSpeed() << endl; 213 orxout() << this->origin_->getPickupRepresentationTemplateSpeed() << endl; 214 215 orxout() << this->origin_->getObstacleTemplate() << endl; 216 //orxout() << crate->getPosition() << endl; 217 } 218 } 219 220 221 // Start new level 199 200 } 201 } 202 203 204 // generate new Flags 222 205 void Hover::createFlags() 223 206 { 224 //Generate 5 flags randomly (test only 1 flag) 225 226 /* do 227 { 228 int i = 0; 229 230 HoverFlag* flag = new HoverFlag(origin_->getContext()); 231 int x = rand()%numCells; 232 int y = rand()%numCells; 233 flag->init(x, y, cellSize); 234 flags_.push_back(flag); 235 236 occupiedCells[x][y] = true; 237 238 i++; 239 240 }while( i<5 || occupiedCells[x][y] == true); 241 */ 242 243 for ( int i = 0; i < 5; i++ ) 244 { 245 HoverFlag* flag = new HoverFlag(origin_->getContext()); 246 flag->init(rand()%numCells, rand()%numCells, cellSize); 247 flags_.push_back(flag); 248 249 250 251 if(flags_[i]->getPosition() == get3dCoordinates(0,0,-60)) 252 { 253 flags_[i]->destroyLater(); 254 flags_.erase(flags_.begin()+i); 255 } 256 } 207 //TODO 208 //Generate flags randomly using bool array 209 210 //Generate 5 flags randomly on field 211 for ( int i = 0; i < 5; i++ ) 212 { 213 HoverFlag* flag = new HoverFlag(origin_->getContext()); 214 flag->init(rand()%numCells, rand()%numCells, cellSize); 215 flags_.push_back(flag); 216 217 218 219 if(flags_[i]->getPosition() == get3dCoordinates(0,0,-60)) 220 { 221 flags_[i]->destroyLater(); 222 flags_.erase(flags_.begin()+i); 223 } 224 } 257 225 258 226 } … … 275 243 276 244 levelUp(); 277 //GSLevel::startMainMenu();278 245 } 279 246 } … … 287 254 } 288 255 256 //start new level - call to create new flags 289 257 void Hover::levelUp() 290 258 { … … 297 265 createFlags(); 298 266 toggleShowLevel(); 299 showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&Hover::toggleShowLevel, this))); 267 showLevelTimer.setTimer(2.0f, false, createExecutor(createFunctor(&Hover::toggleShowLevel, this))); 268 269 //spawn one additional crate randomly 270 Pawn* crate = new Pawn(origin_->getContext()); 271 crate->addTemplate(origin_->getObstacleTemplate()); 272 crate->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 43.0f)); 300 273 301 274 } … … 306 279 } 307 280 281 //if killed, subtract number of lives. If lives == 0, end game 308 282 void Hover::costLife() 309 283 { -
code/branches/tgidronFS16/src/modules/hover/Hover.h
r11192 r11196 24 24 * Co-authors: 25 25 * Cyrill Burgener 26 * Tomer Gidron 26 27 * 27 28 */ … … 77 78 { return this->level; } 78 79 79 bool b ShowLevel;80 bool bLevelUpgradeHUD; 80 81 81 82 private: … … 97 98 std::vector<PickupSpawner*> pickupSpawners_; 98 99 99 void toggleShowLevel(){b ShowLevel = !bShowLevel;}100 void toggleShowLevel(){bLevelUpgradeHUD = !bLevelUpgradeHUD;} 100 101 101 102 Timer showLevelTimer; -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.cc
r11192 r11196 23 23 * Manuel Meier 24 24 * Co-authors: 25 * ...25 * Tomer Gidron 26 26 * 27 27 */ … … 46 46 checkGametype(); 47 47 48 // not needed48 //Initialization of variables (not really needed) 49 49 50 50 pickupTemplate_ = ""; … … 66 66 XMLPortParam(HoverOrigin, "cellSize", setCellSize, getCellSize, xmlelement, mode); 67 67 XMLPortParam(HoverOrigin, "cellHeight", setCellHeight, getCellHeight, xmlelement, mode); 68 XMLPortParam(HoverOrigin, "wallThickness", setWallThickness, getWallThickness, xmlelement, mode); 68 69 XMLPortParam(HoverOrigin, "pickuptemplate", setPickupTemplate, getPickupTemplate, xmlelement, mode); 69 70 XMLPortParam(HoverOrigin, "pickuprepresentationtemplate", setPickupRepresentationTemplate, getPickupRepresentationTemplate, xmlelement, mode); -
code/branches/tgidronFS16/src/modules/hover/HoverOrigin.h
r11192 r11196 23 23 * Manuel Meier 24 24 * Co-authors: 25 * ...25 * Tomer Gidron 26 26 * 27 27 */ … … 65 65 inline int getCellHeight() const 66 66 { return this->cellHeight_; } 67 68 inline void setWallTickness(int wallTickness) 69 { this->wallTickness_ = wallTickness; } 70 inline int getWallTickness() const 71 { return this->wallTickness_; } 67 72 68 73 //pickup template set and get for destroy hover pickup … … 124 129 int cellSize_; 125 130 int cellHeight_; 131 int wallThickness_; 126 132 127 133 // Tempaltes for the destroy hover pickup -
code/branches/tgidronFS16/src/modules/hover/TFlagsLivesLevelHUD.cc
r11192 r11196 46 46 showLevel_ = true; 47 47 showTotFlags_= true; 48 levelUpgrade_ = true; 48 49 } 49 50 … … 55 56 XMLPortParam(TFlagsLivesLevelHUD, "showLives", setShowLives, getShowLives, xmlelement, mode); 56 57 XMLPortParam(TFlagsLivesLevelHUD, "showLevel", setShowLevel, getShowLevel, xmlelement, mode); 58 XMLPortParam(TFlagsLivesLevelHUD, "levelUpgrade", setLevelUpgrade, getLevelUpgrade, xmlelement, mode); 57 59 } 58 60 … … 65 67 const std::string& level = multi_cast<std::string>(this->hoverGame_->getLevel()); 66 68 69 //Display total Flags taken 67 70 if(showTotFlags_ == true){ 68 71 setTextSize(0.04); … … 72 75 } 73 76 74 77 //Display remaining lives 75 78 if(showLives_ == true){ 76 79 setTextSize(0.04); … … 80 83 } 81 84 85 //Display current level 82 86 if(showLevel_ == true){ 83 87 setTextSize(0.04); … … 88 92 } 89 93 90 if(this->hoverGame_->bShowLevel) 94 //New Level pop up 95 if(this->hoverGame_->bLevelUpgradeHUD && levelUpgrade_) 91 96 { 92 setTextSize(0.2); 93 setPosition(Vector2(0.3, 0.55)); 94 std::stringstream sstm; 95 sstm << "Level " << level; 96 this->setCaption(sstm.str()); 97 setTextSize(0.2); 98 setPosition(Vector2(0.3, 0.45)); 99 std::stringstream sstm; 100 sstm << "Level " << level; 101 this->setCaption(sstm.str()); 102 103 //TODO 104 //make others stop blinking when new level pop-up is activated 97 105 } 106 98 107 } 99 108 -
code/branches/tgidronFS16/src/modules/hover/TFlagsLivesLevelHUD.h
r11192 r11196 53 53 inline void setShowTot(int totFlags) 54 54 { this->totFlags_ = totFlags; } 55 /// returns totalflags >=055 /// returns TOTAL flags >=0 56 56 inline int getShowTot() const 57 57 { return this->totFlags_; } … … 85 85 { return this->totLevel_; } 86 86 87 /// sets level Upgrade 88 void setLevelUpgrade(const bool levelUpgrade) 89 { levelUpgrade_ = levelUpgrade; } 90 /// gets level Upgrade 91 const bool getLevelUpgrade() const 92 { return levelUpgrade_; } 93 87 94 88 95 private: … … 93 100 bool showLevel_; 94 101 bool showTotFlags_; 102 bool levelUpgrade_; 95 103 }; 96 104 }
Note: See TracChangeset
for help on using the changeset viewer.