Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11601


Ignore:
Timestamp:
Nov 27, 2017, 3:32:34 PM (6 years ago)
Author:
zarron
Message:

with Highscores

Location:
code/branches/SOBv2_HS17/src/modules/superorxobros
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.cc

    r11418 r11601  
    4444#include "SOBFigure.h"
    4545#include "graphics/Camera.h"
     46#include "Highscore.h"
    4647
    4748
     
    4950namespace orxonox
    5051{
    51 
     52    bool newHighscore=0;
    5253    RegisterUnloadableClass(SOB);
    5354
     
    124125        GSLevel::startMainMenu();
    125126        Deathmatch::end();
    126     }
     127}
    127128
    128129    void SOB::restart() {
     
    167168        if (this->figure_ != nullptr && figure_->lvlEnded_) {
    168169            std::stringstream a;
    169             a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
     170            if(newHighscore){
     171                a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
     172            }
     173            else{
     174                a << "Congrats, new Highscore! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
     175            }
    170176            info_ =a.str();
    171177
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h

    r11418 r11601  
    103103
    104104            WeakPtr<SOBCenterpoint> center_;
     105            bool newHighscore;
    105106
    106107        protected:
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc

    r11599 r11601  
    5050#include "SOBCastlestone.h"
    5151#include "SOBFireball.h"
     52#include "Highscore.h"
    5253#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
    5354
     
    208209            bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
    209210            ball->setDirection(direction);
    210             orxout() << "Rotation: " << this->getWorldOrientation().getRoll() << " direction: "<< direction <<endl;
    211211            if(direction)
    212212            {
     
    229229
    230230    bool inputAllowed = true;
     231    //SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    231232
    232233    //the particle spawner that generates the fire from the backpack when pressed
     
    365366            velocity.x = 0;
    366367            velocity.y = 20;
     368            setOrientation(Vector3::UNIT_Z, Degree(90));
    367369        }
    368370        if (reachedLvlEndState_ == 4) {
     371            //Highscore
     372            if (Highscore::exists()){
     373                    int score = SOBGame->getPoints();
     374                    if(score > Highscore::getInstance().getHighestScoreOfGame("Super Orxo Bros."))
     375                        Highscore::getInstance().storeHighscore("Super Orxo Bros.",score);
     376                        SOBGame->newHighscore=1;
     377
     378            }
    369379            lvlEnded_ = true;
    370380            dead_ = true;
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc

    r11599 r11601  
    140140        hitCounter_++;
    141141       
     142        collDisZ_=0;
     143        collDisX_=0;
     144
    142145        return true;
    143146    }
     
    170173            changedOn_+= dt;
    171174            // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions!
    172             if (changedOn_> 0.100) {
     175            if (changedOn_> 0.2) {
    173176                changeAllowed_ = true;
    174177                changedOn_ = 0.0;
Note: See TracChangeset for help on using the changeset viewer.