Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 12, 2016, 3:45:36 PM (7 years ago)
Author:
meilel
Message:

final changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRace.cc

    r11327 r11334  
    2424 *   Co-authors:
    2525 *      Celine Egger
     26        Berkay Berabi
     27        Louis Meile
    2628 *
    2729 */
     30
     31/*
     32Todo:
     33- improve AI (SpaceRaceController):
     34i) so far bots arent able to evade obstacles. fix that!
     35ii) bots should be able to use pickups
     36- game crashes when bot wins the game
     37- bots rotate while waiting for the countdown to end. make it stop!
     38- add elements to level file to make it even more fun to play. be creative!
     39*/
     40
    2841
    2942#include "SpaceRace.h"
     
    6376        RegisterObject(SpaceRace);
    6477
    65         this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
     78        this->botclass_ = Class(SpaceRaceBot); //ClassByString("")
    6679        this->cantMove_ = false;
    6780        this->bTimeIsUp_ = false;
    6881        this->setConfigValues();
    6982
    70        // this->numberOfBots_ = 1; // quick fix: don't allow default-bots to enter the race
    71                                  // remove this line, if a raceBot has been created.
     83        this->numberOfBots_ = 5; // quick fix: don't allow default-bots to enter the race
    7284    }
    7385
     
    7890    }
    7991
     92    // define spawn positions of the 5 bots
    8093    void SpaceRace::start()
    8194    {
    8295
    83 
    84        /* std::vector<int> spawnpositions;
    85        
    86         spawnpositions.push_back(200);
    87         spawnpositions.push_back(0);
    88         spawnpositions.push_back(100);
    89        
    90         spawnpositions.push_back(200);
    91         spawnpositions.push_back(200);
    92         spawnpositions.push_back(0);
    93        
    94         spawnpositions.push_back(200);
    95         spawnpositions.push_back(0);
    96         spawnpositions.push_back(0);
    97 
    98         spawnpositions.push_back(100);
    99         spawnpositions.push_back(0);
    100         spawnpositions.push_back(0);
    101 
    102         spawnpositions.push_back(0);
    103         spawnpositions.push_back(100);
    104         spawnpositions.push_back(0);
    105 */ 
    10696        int startpos[15];
    10797       
     
    126116        startpos[14] =80;
    127117       
    128         /*startpos[15] =
    129         startpos[0] =
    130         startpos[0] =
    131         startpos[0] =
    132         startpos[0] =
    133         startpos[0] =*/
    134118
    135119
     
    140124            this->spawnPlayersIfRequested();
    141125            this->cantMove_ = true;
    142 
     126            //bots unable to move while countdown is running
    143127            for (Engine* engine : ObjectList<Engine>()){
    144128                engine->setActive(false);
     
    146130
    147131            }
    148            
     132           //append spawn positions to bots
    149133           int a,b,c;
    150134            a=0;
     
    163147                                               
    164148
    165         std::string message("BE FAST BE FIRST");
     149        std::string message("Use headphones to hear the countdown!");
    166150        this->getGametypeInfo()->sendAnnounceMessage(message);
    167151        ChatManager::message(message);
    168152
     153//after 11 s, countdownFinished is called to activate bots` engines
    169154Timer* countdownTimer = new Timer();
    170155        countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
     
    184169        {
    185170            message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
    186                         + "You didn't reach the check point  before the time limit. You lose!";
     171                        + "You lose!";
    187172        }
    188173        else
     
    203188    {
    204189        SUPER(SpaceRace,tick,dt);
    205 
    206 
    207 
    208         // spawns the players when the countdown starts, but deactivates their engines
    209        /* if (this->isStartCountdownRunning() && !this->cantMove_)
    210         {
    211             this->spawnPlayersIfRequested();
    212             this->cantMove_ = true;
    213 
    214             for (Engine* engine : ObjectList<Engine>())
    215                 engine->setActive(false);
    216         }*/
    217 
    218 
    219 //gtinfo_->setStartCountdown(50.0);
    220    
    221        
    222 
    223 
    224 
    225 
    226 
    227 
    228 
    229         // activate the engines when the countdown ends
    230       /*  if (!this->isStartCountdownRunning() && this->cantMove_)
    231         {
    232             for (Engine* engine : ObjectList<Engine>())
    233                 engine->setActive(true);
    234 
    235             this->cantMove_= false;
    236 
    237 
    238 
    239             std::string message = "RACE STARTED!";
    240             this->getGametypeInfo()->sendAnnounceMessage(message);
    241             ChatManager::message(message);
    242         }*/
    243    
    244190}
    245191
     
    289235        for (unsigned int i = 1; i <= amount; ++i){
    290236            this->botclass_.fabricate(this->getContext());
    291             //SpaceRaceBot* bot = new SpaceRaceBot(this->getContext());
    292             //bot->setPosition(-i*150,0,-i*100);
    293         }
    294 
    295 
    296 
    297 
    298     }
    299 
    300 
    301 
    302 
    303 
    304 
     237        }
     238    }
     239
     240
     241//set bot configurations
    305242    bool SpaceRace::allowPawnHit(Pawn* victim, Pawn* originator)
    306243    {
Note: See TracChangeset for help on using the changeset viewer.