Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2011, 10:03:32 PM (13 years ago)
Author:
msalomon
Message:

RaceCheckPoints with a time limit and the version of the level for the presentation.

File:
1 edited

Legend:

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

    r8573 r8616  
    4242    {
    4343        RegisterObject(SpaceRace);
    44         this->checkpointsReached_ = 0;
     44        this->bCheckpointsReached_ = 0;
    4545        this->bTimeIsUp_ = false;
    4646        this->numberOfBots_ = 0;
     
    5555    {
    5656        Gametype::end();
    57         this->stopTimer();
    5857        if (this->bTimeIsUp_) {
    59             COUT(0) << "Time is up" << std::endl;
    60             const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage("Time is up");
     58            this->clock_->capture();
     59            int s = this->clock_->getSeconds();
     60            int ms = this->clock_->getMilliseconds()-1000*s;
     61            const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
     62                                         + "You didn't reach the check point" + multi_cast<std::string>(this->bCheckpointsReached_+1)
     63                                         + " before the time limit. You loose!\n";
     64            COUT(0) << message;
     65            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     66            Host::Broadcast(message);
    6167        }
    6268        else {
     
    6470            int s = this->clock_->getSeconds();
    6571            int ms = this->clock_->getMilliseconds()-1000*s;
    66             const std::string& message = "You have reached the last check point after "+ multi_cast<std::string>(s) +
    67                                           "." + multi_cast<std::string>(ms) + " seconds.";
     72            const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
     73                                          + "." + multi_cast<std::string>(ms) + " seconds.\n";
    6874            COUT(0) << message << std::endl;
    6975            const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
     
    8187        Gametype::start();
    8288       
    83         this->startTimer();
    8489        clock_= new Clock();
    8590        std::string message("The match has started! Reach the check points as quickly as possible!");
     
    9095    void SpaceRace::newCheckpointReached()
    9196    {
    92         this->checkpointsReached_++;
     97        this->bCheckpointsReached_++;
    9398        this->clock_->capture();
    9499        int s = this->clock_->getSeconds();
     
    96101        const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
    97102                                      + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
    98                                       + " seconds.";
     103                                      + " seconds.\n";
    99104        COUT(0) << message << std::endl;
    100105        const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
Note: See TracChangeset for help on using the changeset viewer.