Changeset 11616 for code/branches/Asteroid_HS17/src
- Timestamp:
- Dec 2, 2017, 6:15:54 PM (7 years ago)
- Location:
- code/branches/Asteroid_HS17/src/modules/asteroids2D
- Files:
-
- 2 added
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc
r11613 r11616 34 34 #include "Asteroids2D.h" 35 35 #include "Asteroids2DShip.h" // Necessary for getPlayer function. Do NOT include this in Header! 36 #include "Asteroids2DStone.h" 36 37 #include "core/CoreIncludes.h" 37 38 #include "Highscore.h" … … 46 47 47 48 bEndGame = false; 48 lives = 1;49 lives = 3; 49 50 level = 1; 50 51 point = 0; … … 52 53 multiplier = 1; 53 54 b_combo = false; 54 counter = 5000; 55 pattern = 1; 56 lastPosition = 0; 55 firstTick_ = true; 57 56 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 58 57 this->center_ = nullptr; … … 87 86 void Asteroids2D::tick(float dt) 88 87 { 88 //Do this only for the first tick, generate stones 89 if(this->firstTick_) 90 { 91 for(int i = 0; i < 5; ++i) 92 { 93 spawnStone(); 94 } 95 this->firstTick_ = false; 96 } 89 97 90 98 SUPER(Asteroids2D, tick, dt); 99 } 100 101 void Asteroids2D::spawnStone() 102 { 103 if (getPlayer() == nullptr) 104 return; 105 Asteroids2DStone* newStone = new Asteroids2DStone(this->center_->getContext()); 106 newStone->setAsteroids2DPlayer(player); 107 //addtemplate 108 91 109 } 92 110 … … 151 169 if (Highscore::exists()){ 152 170 int score = this->getPoints(); 153 if(score > Highscore::getInstance().getHighestScoreOfGame(" Dodge Race"))154 Highscore::getInstance().storeHighscore(" Dodge Race",score);171 if(score > Highscore::getInstance().getHighestScoreOfGame("Asteroids2D")) 172 Highscore::getInstance().storeHighscore("Asteroids2D",score); 155 173 156 174 } -
code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h
r11613 r11616 82 82 int getMultiplier(){return this->multiplier;} 83 83 84 void spawnStone(); 84 85 void setCenterpoint(Asteroids2DCenterPoint* center) 85 86 { this->center_ = center; } … … 94 95 int lives; 95 96 int multiplier; 96 float counter;97 int pattern;98 float currentPosition;99 float lastPosition;100 97 101 98 private: … … 104 101 Asteroids2DShip* getPlayer(); 105 102 WeakPtr<Asteroids2DShip> player; 106 std::vector<Asteroids2DCube*> cubeList;107 103 void toggleShowLevel(){bShowLevel = !bShowLevel;} 108 104 void addPoints(int numPoints); … … 111 107 int level; 112 108 int point; 113 bool b_combo ;109 bool b_combo, firstTick_; 114 110 115 111 Timer enemySpawnTimer; -
code/branches/Asteroid_HS17/src/modules/asteroids2D/CMakeLists.txt
r11608 r11616 3 3 Asteroids2DCenterPoint.cc 4 4 Asteroids2DShip.cc 5 Asteroids2D Cube.cc5 Asteroids2DStone.cc 6 6 Asteroids2DHUDinfo.cc 7 7 )
Note: See TracChangeset
for help on using the changeset viewer.