Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10166


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

Final version

Location:
code/branches/surfaceraceHS14
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw

    r10152 r10166  
    11<LevelInfo
    22 name = "Dodge Race"
    3  description = "2D Arcade shooter. Maximise your points!!!\nTip: try to keep the multiplier high by avoiding shots and enemies."
     3 description = "Try to come as far as possible"
    44 tags = "minigame"
    5  screenshot = "orxonoxArcade.png"
     5 screenshot = "DodgeRace.png"
    66/>
    77<?lua
     
    1616  include("templates/enemyInvader.oxt")
    1717  include("templates/DodgeRacePattern.oxt")
    18   include("overlays/InvaderHUD.oxo")
     18  include("overlays/DodgeRaceHUD.oxo")
    1919?>
    2020
  • code/branches/surfaceraceHS14/data/levels/templates/spaceshipDodgeRace.oxt

    r10154 r10166  
    6969  <DodgeRaceShip>
    7070    <camerapositions>
    71       <CameraPosition position="0,30,150" direction="0, 0, -1" drag=false mouselook=true />
    72       <CameraPosition position="0,100,180" direction="0, -0.2, -1" drag=false mouselook=true />
    73       <CameraPosition position="0,1300,-100" direction="0, -1, 0" drag=false mouselook=true />
     71                <CameraPosition position="0,100,180" direction="0, -0.2, -1" drag=false mouselook=true />
     72                <CameraPosition position="0,200,250" direction="0, -0.4, -1" drag=false mouselook=true />
     73                <CameraPosition position="0,30,150" direction="0, 0, -1" drag=false mouselook=true />
     74                <CameraPosition position="0,1300,-100" direction="0, -1, 0" drag=false mouselook=true />
    7475    </camerapositions>
    7576  </DodgeRaceShip>
  • code/branches/surfaceraceHS14/data/overlays/DodgeRaceHUD.oxo

    r10116 r10166  
    66<Template name="DodgeRaceHUD">
    77  <OverlayGroup name="DodgeRaceHUD" scale = "1, 1">
    8     <DodgeRaceHUDinfo
    9      position  = "0.14, 0.02"
    10      pickpoint = "0.0, 0.0"
    11      font      = "ShareTechMono"
    12      textsize  = 0.04
    13      colour    = "1.0, 1.0, 1.0, 1.0"
    14      align     = "left"
    158
    16      showlives     = true
    17      showlevel     = false
    18      showpoints     = false
    19     />
    209    <OverlayText
    2110     position  = "0.02, 0.02"
    22      pickpoint = "0.0, 0.0"
    23      font      = "ShareTechMono"
    24      textsize  = 0.04
    25      colour    = "1.0, 1.0, 1.0, 1.0"
    26      align     = "left"
    27      caption   = "Lives:   "
    28     />
    29 
    30     <OverlayText
    31      position  = "0.02, 0.055"
    32      pickpoint = "0.0, 0.0"
    33      font      = "ShareTechMono"
    34      textsize  = 0.04
    35      colour    = "1.0, 1.0, 1.0, 1.0"
    36      align     = "left"
    37      caption   = "Level: "
    38     />
    39 
    40     <DodgeRaceHUDinfo
    41      position  = "0.14, 0.055"
    42      pickpoint = "0.0, 0.0"
    43      font      = "ShareTechMono"
    44      textsize  = 0.04
    45      colour    = "1.0, 1.0, 1.0, 1.0"
    46      align     = "left"
    47 
    48      showlives     = false
    49      showlevel     = true
    50      showpoints     = false
    51     />
    52 
    53     <OverlayText
    54      position  = "0.02, 0.1"
    5511     pickpoint = "0.0, 0.0"
    5612     font      = "ShareTechMono"
     
    6218
    6319    <DodgeRaceHUDinfo
    64      position  = "0.14, 0.1"
     20     position  = "0.14, 0.02"
    6521     pickpoint = "0.0, 0.0"
    6622     font      = "ShareTechMono"
     
    6925     align     = "left"
    7026
    71      showlives     = false
    72      showlevel     = false
    7327     showpoints     = true
    7428    />
    7529
    76     <DodgeRaceHUDinfo
    77      position  = "0.25, 0.1"
    78      pickpoint = "0.0, 0.0"
    79      font      = "ShareTechMono"
    80      textsize  = 0.04
    81      colour    = "1.0, 1.0, 1.0, 1.0"
    82      align     = "left"
    83 
    84      showMultiplier = true
    85     />
     30   
    8631  </OverlayGroup>
    8732</Template>
    8833
    89 
    9034<Template name="spaceshiphud">
    9135  <OverlayGroup name = "spaceshiphud" scale = "1, 1">
    92     <HUDHealthBar
    93      name              = "HealthBar1"
    94      background        = "Orxonox/HealthBarBackground"
    95      size              = "0.35, 0.0875"
    96      position          = "0.0 , 0.9 "
    97      pickpoint         = "0, 1"
    98      bartexture        = "healthbar_bar.png"
    99      textfont          = "VeraMono"
    100      textusebarcolour  = true
    101      textsize          = 0.039
    102      textoffset        = "0.315, 0.05"
    103      textpickpoint     = "0, 0"
    104      textalign         = "right"
    105      correctaspect     = false
    106      textcorrectaspect = false
    107     >
    108       <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
    109       <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
    110       <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
    111     </HUDHealthBar>
     36   
    11237 </OverlayGroup>
    11338</Template>
  • 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    {
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h

    r10154 r10166  
    7777            virtual void tick(float dt);
    7878
     79            virtual void playerPreSpawn(PlayerInfo* player);
     80
    7981            void levelUp();
    8082
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceHUDinfo.cc

    r10124 r10166  
    4141
    4242        this->DodgeRaceGame = 0;
    43         this->bShowLives_ = false;
    44         this->bShowLevel_ = false;
    45         this->bShowPoints_ = false;
    46         this->bShowMultiplier_ = false;
     43        this->bShowPoints_ = true;
    4744    }
    48 /*
     45
    4946    void DodgeRaceHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5047    {
    5148        SUPER(DodgeRaceHUDinfo, XMLPort, xmlelement, mode);
    5249
    53         XMLPortParam(DodgeRaceHUDinfo, "showlives",     setShowLives,     getShowLives,     xmlelement, mode).defaultValues(false);
    54         XMLPortParam(DodgeRaceHUDinfo, "showPoints",     setShowPoints,     getShowPoints,     xmlelement, mode).defaultValues(false);
    55         XMLPortParam(DodgeRaceHUDinfo, "showLevel",     setShowLevel,     getShowLevel,     xmlelement, mode).defaultValues(false);
    56         XMLPortParam(DodgeRaceHUDinfo, "showMultiplier",     setShowMultiplier,     getShowMultiplier,     xmlelement, mode).defaultValues(false);
     50        XMLPortParam(DodgeRaceHUDinfo,"showPoints", setShowPoints, getShowPoints, xmlelement, mode).defaultValues(false);
    5751    }
    5852
     
    6155        SUPER(DodgeRaceHUDinfo, tick, dt);
    6256
    63         if (this->DodgeRaceGame)
    64         {
    65             if (this->bShowLives_)
    66             {
    67                 const std::string& lives = multi_cast<std::string>(this->DodgeRaceGame->getLives());
    68                 this->setCaption(lives);
    69             }
    70             else if(this->bShowLevel_)
    71             {
    72                 const std::string& Level = multi_cast<std::string>(this->DodgeRaceGame->getLevel());
    73                 if (this->DodgeRaceGame->lives <= 0)
    74                 {
    75                     setPosition(Vector2(0.1, 0.65));
    76                     this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!");
    77                     setTextSize(0.05);
    78                     this->DodgeRaceGame->bEndGame = true;
    79                 }
    80                 else if (this->DodgeRaceGame->bShowLevel)
    81                 {
    82                     setTextSize(0.1);
    83                     setPosition(Vector2(0.3, 0.55));
    84                     std::stringstream sstm;
    85                     sstm << "Level " << Level;
    86                     this->setCaption(sstm.str()); // + level
    87                 }
    88                 else
    89                 {
    90                     setTextSize(0.04);
    91                     setPosition(Vector2(0.14, 0.055));
    92                     this->setCaption(Level);
    93                 }
    94             }
    95             else if(this->bShowPoints_)
    96             {
    97                 const std::string& points = multi_cast<std::string>(this->DodgeRaceGame->getPoints());
    98                 if (this->DodgeRaceGame->lives <= 0)
    99                 {
    100                     setTextSize(0.2);
    101                     setPosition(Vector2(0.1, 0.25));
    102                     this->setCaption("Final score:\n" + points);
    103                     this->setColour(ColourValue(1, 0, 0, 1));
    104                 }
    105                 else
    106                 {
    107                     setTextSize(0.04);
    108                     setPosition(Vector2(0.14, 0.1));
    109                     this->setColour(ColourValue(1, 1, 1, 1));
    110                     this->setCaption(points);
    111                 }
    112             }
    113             else if(this->bShowMultiplier_)
    114             {
    115                 int mult = this->DodgeRaceGame->getMultiplier();
    116                 const std::string& Multiplier = "X " + multi_cast<std::string>(mult);
    117                 this->setCaption(Multiplier);
    118                 this->setColour(ColourValue(1, 0, 0, clamp(float(mult * 0.1), 0.0f, 1.0f)));
    119                 this->setTextSize(clamp(float(mult * 0.1), 0.0f, 1.0f) * 0.01f + 0.04f);
    120             }
    121         }
     57
     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                }
    12276    }
    12377
     
    13488            this->DodgeRaceGame = 0;
    13589        }
    136     }*/
     90    }
    13791}
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceHUDinfo.h

    r10124 r10166  
    4444            DodgeRaceHUDinfo(Context* context);
    4545
    46          //   virtual void tick(float dt);
    47            // virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    48             //virtual void changedOwner();
    49 
    50             inline void setShowLives(bool value)
    51                 { this->bShowLives_ = value; }
    52             inline bool getShowLives() const
    53                 { return this->bShowLives_; }
    54 
    55             inline void setShowLevel(bool value)
    56                 { this->bShowLevel_ = value; }
    57             inline bool getShowLevel() const
    58                 { return this->bShowLevel_; }
     46            virtual void tick(float dt);
     47            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     48            virtual void changedOwner();
    5949
    6050            inline void setShowPoints(bool value)
     
    6353                { return this->bShowPoints_; }
    6454
    65             inline void setShowMultiplier(bool value)
    66                 { this->bShowMultiplier_ = value; }
    67             inline bool getShowMultiplier() const
    68                 { return this->bShowMultiplier_; }
    69 
    7055
    7156        private:
    7257            DodgeRace* DodgeRaceGame;
    73             bool bShowLives_;
    74             bool bShowLevel_;
    7558            bool bShowPoints_;
    76             bool bShowMultiplier_;
    7759    };
    7860}
  • code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc

    r10154 r10166  
    4242        RegisterObject(DodgeRaceShip);
    4343
    44         speed = 800;
     44        speed = 830;
    4545        isFireing = false;
    4646        damping = 10;
     
    6868        {
    6969            float dist_y = velocity.y * dt;
    70             float dist_x = velocity.x * dt;
     70            //float dist_x = velocity.x * dt;
    7171            if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)
    7272                posforeward += dist_y;
     
    7575                velocity.y = 0;
    7676                // restart if game ended
    77                 /*
     77/*
    7878                if (getGame())
    7979                    if (getGame()->bEndGame)
     
    8383                    }*/
    8484            }
    85             /*
    86             if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)
    87             {
    88                 velocity.x = 0;
    89             }
    90             */
     85
    9186            pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;
    92         }
    93 
    94         // shoot!
    95         if (isFireing)
    96         {
    97                 //pos += Vector3(900, 0, 0) * dt;
    98             //ControllableEntity::fire(0);
    9987        }
    10088
     
    150138    void DodgeRaceShip::boost(bool bBoost)
    151139    {
    152         //isFireing = bBoost;
     140        //getGame()->bEndGame = bBoost;
    153141    }
    154142
    155143    inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
    156144    {
    157         /*
    158         if (otherObject != NULL && lastEntity != otherObject)
    159         {
    160                 lastEntity = otherObject;
    161                 removeHealth(20);
    162         }
    163                 */
    164145
    165146        removeHealth(100);
Note: See TracChangeset for help on using the changeset viewer.