- Timestamp:
- Nov 13, 2017, 4:05:34 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Asteroid_HS17/src/modules/asteroids/Asteroids.cc
r11541 r11555 60 60 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 61 61 this->center_ = nullptr; 62 this->lives = 3; 62 63 bEndGame = false; 63 64 lives = 3; … … 65 66 66 67 // Pre-set the timer, but don't start it yet. 67 this->enemySpawnTimer_.setTimer(5.0, true, createExecutor(createFunctor(&Asteroids::spawnStone, this)));68 //this->enemySpawnTimer_.setTimer(5.0, true, createExecutor(createFunctor(&Asteroids::spawnStone, this))); 68 69 } 69 70 … … 79 80 } 80 81 81 /** 82 @brief 83 Destructor. Cleans up, if initialized. 84 */ 85 Asteroids::~Asteroids() 82 void Asteroids::spawnStone(int newsize) 86 83 { 87 if (this->isInitialized()) 88 this->cleanup(); 89 } 84 //no player -> should end game? 85 if(getPlayer() == nullptr) return; 86 //invalid size 87 if(newsize > 3 || newsize < 1) return; 88 AsteroidsStone* newStone; 89 newStone = new AsteroidsStone(this->center_->getContext()); 90 newStone.size = newsize; 91 if(newsize == 1) newStone->addTemplate("asteroidsstone1"); 92 else if(newsize == 2) newStone->addTemplate("asteroidsstone2"); 93 else newStone->addTemplate("asteroidsstone3"); 94 newStone->setAsteroidsPlayer(player); 90 95 91 /**92 @brief93 Cleans up the Gametype by destroying all of the objects in the game - spaceship and asteroids.94 */95 void Asteroids::cleanup()96 {97 if (this->stones_ != nullptr) // Destroy the ball, if present.98 {99 this->stones_->destroy();100 this->stones_ = nullptr;101 }102 103 // Destroy AsteroidsShip104 105 if (this->player != nullptr)106 {107 this->player->destroy();108 this->player = nullptr;109 }110 96 } 111 97
Note: See TracChangeset
for help on using the changeset viewer.