Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10236


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

replaced tabs with spaces. no changes in code.

Location:
code/branches/surfaceraceHS14/src/modules/dodgerace
Files:
6 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)
  • code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRace.h

    r10235 r10236  
    3939
    4040#include "DodgeRaceCenterPoint.h" // Necessary for WeakPointer??
    41 //#include "DodgeRaceShip.h"            DO NOT include in Header. Will cause forward declaration issues
     41//#include "DodgeRaceShip.h"        DO NOT include in Header. Will cause forward declaration issues
    4242
    4343//#include "DodgeRaceHUDinfo.h"
     
    118118
    119119            Timer enemySpawnTimer;
    120                         Timer comboTimer;
    121                         Timer showLevelTimer;
     120            Timer comboTimer;
     121            Timer showLevelTimer;
    122122
    123123
  • code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceCube.cc

    r10232 r10236  
    3636namespace orxonox
    3737{
    38         RegisterClass(DodgeRaceCube);
     38    RegisterClass(DodgeRaceCube);
    3939
    40         DodgeRaceCube::DodgeRaceCube(Context* context) : MovableEntity(context)
    41         {
    42                 RegisterObject(DodgeRaceCube);
    43         }
     40    DodgeRaceCube::DodgeRaceCube(Context* context) : MovableEntity(context)
     41    {
     42        RegisterObject(DodgeRaceCube);
     43    }
    4444
    4545
  • code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceHUDinfo.cc

    r10232 r10236  
    5656
    5757
    58                 if(this->bShowPoints_)
    59                 {
    60                         const std::string& points = multi_cast<std::string>(this->DodgeRaceGame->getPoints());
    61                         if (this->DodgeRaceGame->lives <= 0)
    62                         {
    63                                 setTextSize(0.2);
    64                                 setPosition(Vector2(0.1, 0.02));
    65                                 this->setCaption("Final score:\n" + points);
    66                                 this->setColour(ColourValue(1, 0, 0, 1));
    67                         }
    68                         else
    69                         {
    70                                 setTextSize(0.04);
    71                                 setPosition(Vector2(0.14, 0.02));
    72                                 this->setColour(ColourValue(1, 1, 1, 1));
    73                                 this->setCaption(points);
    74                         }
    75                 }
     58        if(this->bShowPoints_)
     59        {
     60            const std::string& points = multi_cast<std::string>(this->DodgeRaceGame->getPoints());
     61            if (this->DodgeRaceGame->lives <= 0)
     62            {
     63                setTextSize(0.2);
     64                setPosition(Vector2(0.1, 0.02));
     65                this->setCaption("Final score:\n" + points);
     66                this->setColour(ColourValue(1, 0, 0, 1));
     67            }
     68            else
     69            {
     70                setTextSize(0.04);
     71                setPosition(Vector2(0.14, 0.02));
     72                this->setColour(ColourValue(1, 1, 1, 1));
     73                this->setCaption(points);
     74            }
     75        }
    7676    }
    7777
  • code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.cc

    r10232 r10236  
    101101        if(pos.y != 0)
    102102        {
    103                 pos.y = 0;
     103            pos.y = 0;
    104104        }
    105105
     
    126126    void DodgeRaceShip::moveFrontBack(const Vector2& value)
    127127    {
    128         //lastTimeFront = 0;
    129         //desiredVelocity.y = value.y * speed * 42;
     128        //lastTimeFront = 0;
     129        //desiredVelocity.y = value.y * speed * 42;
    130130
    131131    }
     
    133133    void DodgeRaceShip::moveRightLeft(const Vector2& value)
    134134    {
    135         lastTimeLeft = 0;
    136         desiredVelocity.x = value.x * speed;
     135        lastTimeLeft = 0;
     136        desiredVelocity.x = value.x * speed;
    137137    }
    138138    void DodgeRaceShip::boost(bool bBoost)
     
    144144    {
    145145
    146         removeHealth(100);
    147         this->death();
     146        removeHealth(100);
     147        this->death();
    148148        return false;
    149149    }
     
    155155            for (ObjectList<DodgeRace>::iterator it = ObjectList<DodgeRace>::begin(); it != ObjectList<DodgeRace>::end(); ++it)
    156156            {
    157                 game = *it;
     157                game = *it;
    158158            }
    159159        }
  • code/branches/surfaceraceHS14/src/modules/dodgerace/DodgeRaceShip.h

    r10234 r10236  
    5757
    5858            // overwrite for 2d movement
    59                     virtual void moveFrontBack(const Vector2& value);
    60                     virtual void moveRightLeft(const Vector2& value);
     59            virtual void moveFrontBack(const Vector2& value);
     60            virtual void moveRightLeft(const Vector2& value);
    6161
    62                     // Starts or stops fireing
    63                     virtual void boost(bool bBoost);
     62            // Starts or stops fireing
     63            virtual void boost(bool bBoost);
    6464
    65                     //no rotation!
    66                     virtual void rotateYaw(const Vector2& value){};
    67                     virtual void rotatePitch(const Vector2& value){};
     65            //no rotation!
     66            virtual void rotateYaw(const Vector2& value){};
     67            virtual void rotatePitch(const Vector2& value){};
    6868
    69                     //return to main menu if game has ended.
    70                     virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
     69            //return to main menu if game has ended.
     70            virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
    7171
    72                     virtual void updateLevel();
     72            virtual void updateLevel();
    7373
    7474            float speed, damping, posforeward;
     
    8888            struct Velocity
    8989            {
    90                            float x;
    91                            float y;
     90                float x;
     91                float y;
    9292            } velocity, desiredVelocity;
    9393
Note: See TracChangeset for help on using the changeset viewer.