Changeset 11177 for code/branches/tgidronFS16/src/modules/hover/Hover.cc
- Timestamp:
- Apr 28, 2016, 4:04:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.