[Orxonox-commit 7009] r11628 - code/branches/SOBv2_HS17/src/modules/superorxobros

varxth at orxonox.net varxth at orxonox.net
Mon Dec 4 15:29:13 CET 2017


Author: varxth
Date: 2017-12-04 15:29:13 +0100 (Mon, 04 Dec 2017)
New Revision: 11628

Modified:
   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/SOBGumbaBoss.cc
Log:
more improvements

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h	2017-12-04 14:25:56 UTC (rev 11627)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOB.h	2017-12-04 14:29:13 UTC (rev 11628)
@@ -75,6 +75,9 @@
             void addGumba() {
                 points_+=100;
             }
+            void addGumbaBoss() {
+                points_+=5000;
+            }
             void addPoints(int poi) {
                 points_+=poi;
             }

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-12-04 14:25:56 UTC (rev 11627)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-12-04 14:29:13 UTC (rev 11628)
@@ -44,6 +44,7 @@
 
 #include "SOBMushroom.h"
 #include "SOBGumba.h"
+#include "SOBGumbaBoss.h"
 #include "SOBFireball.h"
 #include "SOB.h"
 #include "SOBFlagstone.h"
@@ -113,9 +114,10 @@
         //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr
         SOBMushroom*    mush        = orxonox_cast<SOBMushroom*>    (otherObject);
         SOBGumba*       gumba       = orxonox_cast<SOBGumba*>       (otherObject);
+        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>       (otherObject);
         SOBFlagstone*   flagstone   = orxonox_cast<SOBFlagstone*>   (otherObject);
         SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*> (otherObject);
-        SOBFireball* fireball       = orxonox_cast<SOBFireball*>    (otherObject);
+        SOBFireball*    fireball    = orxonox_cast<SOBFireball*>    (otherObject);
         SOB* SOBGame                = orxonox_cast<SOB*>            (getGametype()); 
 
 
@@ -132,11 +134,12 @@
             
             
         }
+
         
 
         //Check if otherObject is a Gumba (that walking enemies)
 
-         else if (gumba != nullptr && !(gumba->hasCollided_)) {
+         else if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
 
             //If player jumps on its head, kill the Gumba, else, kill the player
             if (getVelocity().z >= -20) {
@@ -158,9 +161,20 @@
             SOBGame->addGumba();
 
 
+            }
         }
-    }
+        else if (gumbaBoss != nullptr && !(gumbaBoss->hasCollided_)) {
+            if (getVelocity().z >= -20) {
+                // If player hasn't a power up, he dies. Else he dies directly.
+                this->die(); 
+            }
 
+            else {
+                gumbaBoss->destroyLater();
+                gumbaBoss->hasCollided_ = true;
+                SOBGame->addGumbaBoss();
+                }
+        }
         else if (fireball != nullptr && !(fireball->hasCollided_)){
             if(PowerUpCounter_ == 0){
                     this->die();
@@ -167,6 +181,7 @@
                 } 
             PowerUpCounter_--;
             this->changeClothes();
+            fireball->destroyLater();
         }
 
     //Purpose is that if player hits the flag, he should walk into the castle at the end of the level. For that we use SOBCastlestone

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc	2017-12-04 14:25:56 UTC (rev 11627)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc	2017-12-04 14:29:13 UTC (rev 11628)
@@ -53,7 +53,7 @@
     {
         RegisterObject(SOBGumbaBoss);
 
-        gumbaMaxTime_ = 10;
+        gumbaMaxTime_ = 5;
         gumbaTime_ = 0;
         
     }
@@ -90,11 +90,9 @@
         }
     
         gumbaTime_ += dt;
-        orxout() << "gumbaTime_ = " << gumbaTime_ << endl;
 
         if(gumbaTime_ > gumbaMaxTime_){
             spawnFireball();
-            orxout() << "shoot" << endl;
             gumbaTime_ = 0;
         }
 



More information about the Orxonox-commit mailing list