Changeset 11617 for code/branches/Asteroid_HS17/src/modules
- Timestamp:
- Dec 3, 2017, 6:02:22 PM (7 years ago)
- Location:
- code/branches/Asteroid_HS17/src/modules/asteroids2D
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
r11616 r11617 26 26 * 27 27 */ 28 29 /*TODO: Punktesystem aufbauen -> in HUD anzeigen 30 Schwierigkeitsgrad mit jedem levelup erhöhen -> mehr Steine spawnen? 31 spawnStone Methode schreiben 32 templates für die drei Grössen von Asteroiden erstellen 28 33 29 34 /** … … 57 62 this->center_ = nullptr; 58 63 this->setHUDTemplate("Asteroids2DHUD"); 64 levelupTimer.setTimer(100.0f, true, createExecutor(createFunctor(&Asteroids2D::levelUp, this))); 59 65 } 60 66 … … 82 88 toggleShowLevel(); 83 89 showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&Asteroids2D::toggleShowLevel, this))); 90 //Nach jedem Level Up werden mehr Steine gespawnt -> abhängig vom Schwierigkeitsgrad 91 for(int i = 0; i < level*2; i++){ 92 spawnStone(); 93 } 94 84 95 } 85 96 86 97 void Asteroids2D::tick(float dt) 87 98 { 88 //Do this only for the first tick, generate stones99 //Do this only for the first tick, generate 5 stones for the beginning 89 100 if(this->firstTick_) 90 101 { … … 105 116 Asteroids2DStone* newStone = new Asteroids2DStone(this->center_->getContext()); 106 117 newStone->setAsteroids2DPlayer(player); 107 //addtemplate 118 119 switch(newStone->getSize()){ 120 case 1: 121 newStone->addTemplate("stone1"); 122 break; 123 case 2: 124 newStone->addTemplate("stone2"); 125 break; 126 case 3: 127 newStone->addTemplate("stone3"); 128 break; 129 default: 130 orxout(internal_error) << "Asteroids2DStone has invalid size and cannot be created" << endl; 131 break; 132 133 } 134 108 135 109 136 } … … 123 150 void Asteroids2D::costLife() 124 151 { 125 //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&Asteroids2D::end, this))); 126 lives = 0; 152 --lives; 153 if(live <= 0){ 154 endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&Asteroids2D::end, this))); 155 } 127 156 }; 157 128 158 129 159 void Asteroids2D::start() … … 152 182 } 153 183 184 //wird gerufen, falls man einen Asteroiden trifft->Aufruf durch Schiffklasse 154 185 void Asteroids2D::addPoints(int numPoints) 155 186 { -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h
r11616 r11617 26 26 * 27 27 */ 28 29 28 30 29 31 /** … … 109 111 bool b_combo, firstTick_; 110 112 111 Timer enemySpawnTimer;112 113 Timer comboTimer; 113 114 Timer showLevelTimer; 115 Timer levelupTimer; 116 Timer endGameTimer; 114 117 115 116 /*117 118 //void spawnEnemy();119 120 121 122 123 124 125 126 127 128 129 130 131 private:132 133 134 135 136 //Context* context;137 */138 118 }; 139 119 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc
r11613 r11617 27 27 */ 28 28 29 /*TODO: orientation/direction of the ship must be defined 30 implement shoot function ->or switch it on? 31 switch off boosting particles in the back of the ship 32 29 33 /** 30 34 @file Asteroids2DShip.cc … … 49 53 this->height = 646; 50 54 51 // not sure if has to be zero?52 lastTimeFront = 0;53 lastTimeLeft = 0;54 lastTime = 0;55 55 timer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2DShip::showposition, this))); 56 56 } … … 85 85 void Asteroids2DShip::updateLevel() 86 86 { 87 lastTime = 0;88 87 if (getGame()) 89 88 getGame()->levelUp(); -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h
r11614 r11617 87 87 WeakPtr<Asteroids2D> game; 88 88 WeakPtr<WorldEntity> lastEntity; 89 float lastTimeFront, lastTimeLeft, lastTime;90 89 struct Velocity 91 90 {
Note: See TracChangeset
for help on using the changeset viewer.