Changeset 11171 for code/branches/tgidronFS16/src/modules
- Timestamp:
- Apr 21, 2016, 3:37:28 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
r11168 r11171 8 8 FlagHUD.cc 9 9 MazeGenerator.cc 10 FlagsAndLivesHUD.cc 10 11 ) 11 12 -
code/branches/tgidronFS16/src/modules/hover/Hover.cc
r11169 r11171 40 40 #include "core/CoreIncludes.h" 41 41 #include "gamestates/GSLevel.h" 42 #include "HoverShip.h" 42 43 43 44 #include "pickup/PickupSpawner.h" … … 57 58 level = 1; //start at level 1 58 59 flagsTaken = 0;// took 0 flags in the beginning 60 lives = 3; 59 61 60 62 numCells = 0; … … 132 134 pickupSpawners_.push_back(pickupSpawner); 133 135 } 136 //If no lives are left, end game 137 if(lives <= 0){ 138 GSLevel::startMainMenu(); 139 } 134 140 135 141 orxout() << this->origin_->getPickupTemplate() << endl; … … 153 159 for (int i = 0; i<5; i++) 154 160 { 155 PickupSpawner* pickup = new PickupSpawner(origin_->getContext()); 156 //PickupSpawner->setPosition(rand()%numCells, rand()%numCells, cellSize); 157 //pickup->createDroppedPickup(this->getContext(), pickup , this, 5); 158 pickupSpawners_.push_back(pickup); 161 PickupSpawner* pickupSpawner = new PickupSpawner(origin_->getContext()); 162 163 pickupSpawner->setPosition(get3dCoordinates(rand()%numCells, rand()%numCells, 10.0f)); 164 pickupSpawner->setPickupTemplateName(origin_->getPickupTemplate()); 165 pickupSpawner->setMaxSpawnedItems(5); 166 pickupSpawner->setRespawnTime(30); 167 pickupSpawner->setTriggerDistance(5); 168 // Add pickup spawner to the pickup spawner list 169 pickupSpawners_.push_back(pickupSpawner); 159 170 } 160 171 … … 185 196 } 186 197 numberOfFlags_ = flags_.size(); 198 199 if(lives <= 0){ 200 GSLevel::startMainMenu(); 201 } 187 202 } 188 203 … … 198 213 return Vector3(x*cellSize*1.0f + cellSize/2, heightOffset, y*cellSize*1.0f + cellSize/2); 199 214 } 215 216 void Hover::costLife() 217 { 218 lives--; 219 if (lives <= 0) 220 GSLevel::startMainMenu(); 221 } 200 222 } -
code/branches/tgidronFS16/src/modules/hover/Hover.h
r11169 r11171 37 37 38 38 #include "HoverPrereqs.h" 39 #include "HoverShip.h" 39 40 40 41 #include <vector> … … 60 61 void levelUp(); 61 62 void endLevel(); 63 void costLife(); 62 64 63 65 inline int getNumberOfFlags() const … … 66 68 virtual Vector3 get3dCoordinates(int x, int y, float heightOffset); 67 69 70 inline int getTotFlags() const 71 { return this->totFlags; } 72 73 inline int getLives() const 74 { return this->lives; } 75 68 76 private: 77 69 78 WeakPtr<HoverOrigin> origin_; 70 79 std::vector<HoverFlag*> flags_; -
code/branches/tgidronFS16/src/modules/hover/HoverShip.cc
r11151 r11171 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" 35 #include "Hover.h" 35 36 //#include "NewHumanController.h" 36 37 … … 122 123 } 123 124 } 125 126 Hover* HoverShip::getGame() 127 { 128 if (game == nullptr) 129 { 130 for (Hover* hover : ObjectList<Hover>()) 131 game = hover; 132 } 133 return game; 134 } 135 136 void HoverShip::death() 137 { 138 getGame()->costLife(); 139 SpaceShip::death(); 140 } 124 141 } -
code/branches/tgidronFS16/src/modules/hover/HoverShip.h
r11071 r11171 34 34 35 35 #include "HoverPrereqs.h" 36 #include "Hover.h" 36 37 37 38 #include "worldentities/pawns/SpaceShip.h" … … 69 70 virtual void boost(bool bBoost) override; 70 71 72 protected: 73 virtual void death() override; 74 71 75 private: 76 Hover* getGame(); 77 WeakPtr<Hover> game; 72 78 float jumpBoost_; 73 79 bool isFloor_;
Note: See TracChangeset
for help on using the changeset viewer.