[Orxonox-commit 6980] r11601 - code/branches/SOBv2_HS17/src/modules/superorxobros

zarron at orxonox.net zarron at orxonox.net
Mon Nov 27 15:32:34 CET 2017


Author: zarron
Date: 2017-11-27 15:32:34 +0100 (Mon, 27 Nov 2017)
New Revision: 11601

Modified:
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.cc
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc
Log:
with Highscores

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.cc	2017-11-27 14:29:03 UTC (rev 11600)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.cc	2017-11-27 14:32:34 UTC (rev 11601)
@@ -43,12 +43,13 @@
 #include "SOBCenterpoint.h"
 #include "SOBFigure.h"
 #include "graphics/Camera.h"
+#include "Highscore.h"
 
 
 
 namespace orxonox
 {
-
+    bool newHighscore=0;
     RegisterUnloadableClass(SOB);
 
     /**
@@ -123,7 +124,7 @@
         cleanup();
         GSLevel::startMainMenu();
         Deathmatch::end();
-    }
+}
 
     void SOB::restart() {
         cleanup();
@@ -166,7 +167,12 @@
         //If player has reached end of level
         if (this->figure_ != nullptr && figure_->lvlEnded_) {
             std::stringstream a;
-            a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
+            if(newHighscore){
+                a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
+            }
+            else{
+                a << "Congrats, new Highscore! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
+            }
             info_ =a.str();
 
         //If player has died

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h	2017-11-27 14:29:03 UTC (rev 11600)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h	2017-11-27 14:32:34 UTC (rev 11601)
@@ -102,6 +102,7 @@
             }  
 
             WeakPtr<SOBCenterpoint> center_;
+            bool newHighscore;
 
         protected:
 

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-11-27 14:29:03 UTC (rev 11600)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-11-27 14:32:34 UTC (rev 11601)
@@ -49,6 +49,7 @@
 #include "SOBFlagstone.h"
 #include "SOBCastlestone.h"
 #include "SOBFireball.h"
+#include "Highscore.h"
 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
 
 namespace orxonox
@@ -207,7 +208,6 @@
             ball->addTemplate("fireball");
             bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
             ball->setDirection(direction);
-            orxout() << "Rotation: " << this->getWorldOrientation().getRoll() << " direction: "<< direction <<endl;
             if(direction)
             {
                 spawnpos.x+=10;
@@ -228,6 +228,7 @@
 
 
     bool inputAllowed = true;
+    //SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
 
     //the particle spawner that generates the fire from the backpack when pressed
     if (particlespawner_ == NULL) {
@@ -364,8 +365,17 @@
         if (reachedLvlEndState_ == 3) {
             velocity.x = 0;
             velocity.y = 20;
+            setOrientation(Vector3::UNIT_Z, Degree(90));
         }
         if (reachedLvlEndState_ == 4) {
+            //Highscore
+            if (Highscore::exists()){
+                    int score = SOBGame->getPoints();
+                    if(score > Highscore::getInstance().getHighestScoreOfGame("Super Orxo Bros.")) 
+                        Highscore::getInstance().storeHighscore("Super Orxo Bros.",score);
+                        SOBGame->newHighscore=1;
+
+            }
             lvlEnded_ = true;
             dead_ = true;
         }

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc	2017-11-27 14:29:03 UTC (rev 11600)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc	2017-11-27 14:32:34 UTC (rev 11601)
@@ -139,6 +139,9 @@
 
         hitCounter_++;
         
+        collDisZ_=0;
+        collDisX_=0;
+
         return true;
     }
 
@@ -169,7 +172,7 @@
         if (!changeAllowed_) {
             changedOn_+= dt;
             // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions!
-            if (changedOn_> 0.100) {
+            if (changedOn_> 0.2) {
                 changeAllowed_ = true;
                 changedOn_ = 0.0;
 



More information about the Orxonox-commit mailing list