Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2014, 3:40:05 PM (11 years ago)
Author:
sriedel
Message:

Final version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc

    r10154 r10166  
    4646        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
    4747        this->center_ = 0;
    48         /*
    49         this->setHUDTemplate("DodgeRaceHUD"); // !!!!!!!!!!!!!!!        change later*/
     48
     49        this->setHUDTemplate("DodgeRaceHUD");
    5050    }
    5151
     
    5353    {
    5454        bEndGame = false;
    55         lives = 3;
     55        lives = 1;
    5656        level = 1;
    5757        point = 0;
     
    5959        multiplier = 1;
    6060        b_combo = false;
    61         counter = 0;
     61        counter = 5000;
    6262        pattern = 1;
    6363        lastPosition = 0;
     
    9595                        counter = counter + (currentPosition - lastPosition);
    9696                        lastPosition = currentPosition;
    97 
    98                         for(int i=0; i< cubeList.size();i++)
     97                        point = currentPosition;
     98                        getPlayer()->speed = 830 - (point / 1000);
     99
     100                        for(uint i=0; i < cubeList.size();i++)
    99101                        {
    100102                                if(cubeList.at(i)->getPosition().x < currentPosition-3000)
     
    108110                        {
    109111                                counter = 0;
    110 
    111112                                for(int i = 0; i<6; i++)
    112113                                {
     
    147148        return player;
    148149    }
    149 /*
    150     void DodgeRace::spawnEnemy()
    151     {
    152         if (getPlayer() == NULL)
    153             return;
    154 
    155         for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++)
    156         {
    157             WeakPtr<DodgeRaceEnemy> newPawn;
    158             if (rand() % 42/(1 + level*level) == 0)
    159             {
    160                 newPawn = new DodgeRaceEnemyShooter(this->center_->getContext());
    161                 newPawn->addTemplate("enemyinvadershooter");
    162             }
    163             else
    164             {
    165                 newPawn = new DodgeRaceEnemy(this->center_->getContext());
    166                 newPawn->addTemplate("enemyinvader");
    167             }
    168             newPawn->setPlayer(player);
    169             newPawn->level = level;
    170             // spawn enemy at random points in front of player.
    171             newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
    172         }
    173     }
    174 */
     150
    175151    void DodgeRace::costLife()
    176152    {
    177         orxout() << "CostLife" << endl;
    178         endGameTimer.setTimer(3.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
    179 
    180         multiplier = 1;
     153        //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
     154        lives = 0;
    181155    };
    182156
     
    193167    void DodgeRace::start()
    194168    {
    195         orxout() << "start function called." << endl;
     169        orxout() << "start" << endl;
    196170        init();
     171                for(uint i=0; i< cubeList.size();i++)
     172                {
     173                        cubeList.at(i)->destroy();
     174                        cubeList.erase(cubeList.begin()+i);
     175
     176                }
     177        cubeList.clear();
     178        // Set variable to temporarily force the player to spawn.
     179        this->bForceSpawn_ = false;
     180
     181        if (this->center_ == NULL)  // abandon mission!
     182        {
     183            orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
     184            GSLevel::startMainMenu();
     185            return;
     186        }
     187        // Call start for the parent class.
     188        Deathmatch::start();
     189    }
     190
     191        void DodgeRace::playerPreSpawn(PlayerInfo* player)
     192        {
     193                if(lives <= 0)
     194                {
     195                        this->end();
     196                }
     197
     198                // Reset all the cubes
     199                /*
     200                orxout() << "prespawn" << endl;
     201                init();
    197202                for(int i=0; i< cubeList.size();i++)
    198203                {
    199204                        cubeList.at(i)->destroy();
    200205                        cubeList.erase(cubeList.begin()+i);
    201 
    202206                }
    203         cubeList.clear();
    204         // Set variable to temporarily force the player to spawn.
    205         this->bForceSpawn_ = true;
    206 
    207         if (this->center_ == NULL)  // abandon mission!
    208         {
    209             orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl;
    210             GSLevel::startMainMenu();
    211             return;
    212         }
    213         // Call start for the parent class.
    214         Deathmatch::start();
    215     }
     207                cubeList.clear();
     208        lives = 1;
     209        point = 0;
     210        lastPosition = 0;
     211        */
     212        }
     213
    216214    void DodgeRace::addPoints(int numPoints)
    217215    {
Note: See TracChangeset for help on using the changeset viewer.