Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 1, 2015, 3:56:21 PM (9 years ago)
Author:
landauf
Message:

replaced tabs with spaces. no changes in code.

File:
1 edited

Legend:

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

    r10235 r10236  
    8888    void DodgeRace::tick(float dt)
    8989    {
    90         if (getPlayer() != NULL)
    91         {
    92                         //WeakPtr<DodgeRaceShip> ship = getPlayer();
    93 
    94                         currentPosition = getPlayer()->getWorldPosition().x;
    95                         counter = counter + (currentPosition - lastPosition);
    96                         lastPosition = currentPosition;
    97                         point = (int) currentPosition;
    98                         getPlayer()->speed = 830.0f - (point / 1000);
    99 
    100                         for(unsigned int i=0; i < cubeList.size();i++)
    101                         {
    102                                 if(cubeList.at(i)->getPosition().x < currentPosition-3000)
    103                                 {
    104                                         cubeList.at(i)->destroy();
    105                                         cubeList.erase(cubeList.begin()+i);
    106                                 }
    107                         }
    108 
    109                         if(counter >= 3000)
    110                         {
    111                                 counter = 0;
    112                                 for(int i = 0; i<6; i++)
    113                                 {
    114                                         WeakPtr<DodgeRaceCube> cube = new DodgeRaceCube(this->center_->getContext());
    115                                         cubeList.push_back(cube);
    116                                         switch(pattern)
    117                                         {
    118                                         case 1: cube->addTemplate("DodgeRaceCube01");
    119                                         break;
    120                                         case 2: cube->addTemplate("DodgeRaceCube02");
    121                                         break;
    122 
    123                                         }
    124 
    125                                         cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000.0f, 0.0f, -3600.0f + (i*1200)));
    126                                         //stEntity->setScale3D(50,50,50);
    127                                 }
    128 
    129 
    130                                 pattern %= 2;
    131                                 pattern ++;
    132 
    133                         }
    134 
    135         }
    136         SUPER(DodgeRace, tick, dt);
     90        if (getPlayer() != NULL)
     91        {
     92            //WeakPtr<DodgeRaceShip> ship = getPlayer();
     93
     94            currentPosition = getPlayer()->getWorldPosition().x;
     95            counter = counter + (currentPosition - lastPosition);
     96            lastPosition = currentPosition;
     97            point = (int) currentPosition;
     98            getPlayer()->speed = 830.0f - (point / 1000);
     99
     100            for(unsigned int i=0; i < cubeList.size();i++)
     101            {
     102                if(cubeList.at(i)->getPosition().x < currentPosition-3000)
     103                {
     104                    cubeList.at(i)->destroy();
     105                    cubeList.erase(cubeList.begin()+i);
     106                }
     107            }
     108
     109            if(counter >= 3000)
     110            {
     111                counter = 0;
     112                for(int i = 0; i<6; i++)
     113                {
     114                    WeakPtr<DodgeRaceCube> cube = new DodgeRaceCube(this->center_->getContext());
     115                    cubeList.push_back(cube);
     116                    switch(pattern)
     117                    {
     118                    case 1: cube->addTemplate("DodgeRaceCube01");
     119                    break;
     120                    case 2: cube->addTemplate("DodgeRaceCube02");
     121                    break;
     122
     123                    }
     124
     125                    cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000.0f, 0.0f, -3600.0f + (i*1200)));
     126                    //stEntity->setScale3D(50,50,50);
     127                }
     128
     129
     130                pattern %= 2;
     131                pattern ++;
     132
     133            }
     134
     135        }
     136        SUPER(DodgeRace, tick, dt);
    137137    }
    138138
     
    143143            for (ObjectList<DodgeRaceShip>::iterator it = ObjectList<DodgeRaceShip>::begin(); it != ObjectList<DodgeRaceShip>::end(); ++it)
    144144            {
    145                 player = *it;
     145                player = *it;
    146146            }
    147147        }
     
    151151    void DodgeRace::costLife()
    152152    {
    153         //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
    154         lives = 0;
     153        //endGameTimer.setTimer(8.0f, false, createExecutor(createFunctor(&DodgeRace::end, this)));
     154        lives = 0;
    155155    };
    156156
     
    167167    void DodgeRace::start()
    168168    {
    169         orxout() << "start" << endl;
     169        orxout() << "start" << endl;
    170170        init();
    171                 for(unsigned int i=0; i< cubeList.size();i++)
    172                 {
    173                         cubeList.at(i)->destroy();
    174                         cubeList.erase(cubeList.begin()+i);
    175 
    176                 }
     171        for(unsigned int i=0; i< cubeList.size();i++)
     172        {
     173            cubeList.at(i)->destroy();
     174            cubeList.erase(cubeList.begin()+i);
     175
     176        }
    177177        cubeList.clear();
    178178        // Set variable to temporarily force the player to spawn.
     
    189189    }
    190190
    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();
    202                 for(int i=0; i< cubeList.size();i++)
    203                 {
    204                         cubeList.at(i)->destroy();
    205                         cubeList.erase(cubeList.begin()+i);
    206                 }
    207                 cubeList.clear();
     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();
     202        for(int i=0; i< cubeList.size();i++)
     203        {
     204            cubeList.at(i)->destroy();
     205            cubeList.erase(cubeList.begin()+i);
     206        }
     207        cubeList.clear();
    208208        lives = 1;
    209209        point = 0;
    210210        lastPosition = 0;
    211211        */
    212         }
     212    }
    213213
    214214    void DodgeRace::addPoints(int numPoints)
Note: See TracChangeset for help on using the changeset viewer.