Changeset 11645 for code/branches/Asteroid_HS17/src/modules/asteroids2D
- Timestamp:
- Dec 9, 2017, 1:29:44 PM (7 years ago)
- Location:
- code/branches/Asteroid_HS17/src/modules/asteroids2D
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
r11637 r11645 52 52 53 53 bEndGame = false; 54 lives = 5;54 lives = 1000; 55 55 level = 1; 56 56 point = 0; … … 158 158 }; 159 159 160 160 //Funktion wird als erstes im Level aufgerufen 161 161 void Asteroids2D::start() 162 162 { -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.cc
r11637 r11645 41 41 42 42 this->Asteroids2DGame = nullptr; 43 this->Ship = nullptr;43 //this->Ship = nullptr; 44 44 this->bShowPoints_ = true; 45 45 this->bShowHealth_ = true; … … 51 51 52 52 XMLPortParam(Asteroids2DHUDinfo,"showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false); 53 XMLPortParam(Asteroids2DHUDinfo,"showHealth", setShowHealth, getShowHealth, xmlelement, mode).defaultValues(false);54 53 } 55 54 -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DHUDinfo.h
r11637 r11645 61 61 private: 62 62 Asteroids2D* Asteroids2DGame; 63 Asteroids2DShip* Ship; 63 bool bShowLives_; 64 bool bShowLevel_; 64 65 bool bShowPoints_; 65 66 bool bShowHealth_; 67 66 68 }; 67 69 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc
r11643 r11645 98 98 { 99 99 100 orxout() << "touched" << endl;101 100 Asteroids2DStone* stone = orxonox_cast<Asteroids2DStone*>(otherObject); 102 if(stone != nullptr && (stone != lastStone || lastStone == nullptr))101 if(stone != nullptr && !bImmune) 103 102 { 104 103 removeHealth(100); 105 lastStone = stone; 106 104 this->getGame()->addPoints(10); 105 106 //The ship will be immune for 3 seconds after it has been hit by an asteroid 107 bImmune = true; 108 isimmune.setTimer(3.0f, false, createExecutor(createFunctor(&Asteroids2DShip::toggleImmune, this))); 109 orxout()<< "touched" << endl; 107 110 } 108 111 return false; -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h
r11643 r11645 68 68 virtual void rotateRoll(const Vector2& value) override{}; // Rotate in roll direction. 69 69 70 71 72 70 virtual void updateLevel(); 73 71 … … 77 75 bool isFireing; 78 76 void showposition(); 77 void toggleImmune() 78 { 79 bImmune = !bImmune; 80 } 79 81 80 82 protected: … … 86 88 float width, height; 87 89 WeakPtr<Asteroids2D> game; 88 WeakPtr<Asteroids2DStone> lastStone; 89 90 bool bImmune; 90 91 Timer timer; 92 Timer isimmune; 91 93 }; 92 94 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/CMakeLists.txt
r11616 r11645 5 5 Asteroids2DStone.cc 6 6 Asteroids2DHUDinfo.cc 7 Asteroids2DWeapon.cc 7 8 ) 8 9
Note: See TracChangeset
for help on using the changeset viewer.