Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 13, 2017, 4:05:34 PM (8 years ago)
Author:
vyang
Message:

Level file: korrekte Kameraposition, Raumschiff bewegt sich nicht, schiesst aber → wird AsteroidsShip ueberhaupt geladen? AsteroidsShip: neue Steuerung (vgl Jump, Rotation muss noch angepasst werden)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/src/modules/asteroids/Asteroids.cc

    r11541 r11555  
    6060        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
    6161        this->center_ = nullptr;
     62        this->lives = 3;
    6263        bEndGame = false;
    6364        lives = 3;
     
    6566
    6667        // 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)));
    6869    }
    6970
     
    7980    }
    8081
    81     /**
    82     @brief
    83         Destructor. Cleans up, if initialized.
    84     */
    85     Asteroids::~Asteroids()
     82    void Asteroids::spawnStone(int newsize)
    8683    {
    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);
    9095
    91     /**
    92     @brief
    93         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 AsteroidsShip
    104 
    105         if (this->player != nullptr)
    106         {
    107             this->player->destroy();
    108             this->player = nullptr;
    109         }
    11096    }
    11197
Note: See TracChangeset for help on using the changeset viewer.