[Orxonox-commit 7031] r11650 - in code/branches/SOBv2_HS17: . data/levels src/modules/superorxobros

varxth at orxonox.net varxth at orxonox.net
Mon Dec 11 14:14:15 CET 2017


Author: varxth
Date: 2017-12-11 14:14:15 +0100 (Mon, 11 Dec 2017)
New Revision: 11650

Modified:
   code/branches/SOBv2_HS17/SOB.oxw
   code/branches/SOBv2_HS17/data/levels/SOB.oxw
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFlagstone.h
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h
Log:
better than evver

Modified: code/branches/SOBv2_HS17/SOB.oxw
===================================================================
--- code/branches/SOBv2_HS17/SOB.oxw	2017-12-11 13:04:37 UTC (rev 11649)
+++ code/branches/SOBv2_HS17/SOB.oxw	2017-12-11 13:14:15 UTC (rev 11650)
@@ -13,9 +13,6 @@
 	include("overlays/SOBHUD.oxo")
 	?>
 
-					<!--THEO-->
-
-
 	<Template name=mushroom defaults=0>
 		<SOBMushroom collisionType="dynamic" speed=30>
 			<attached>

Modified: code/branches/SOBv2_HS17/data/levels/SOB.oxw
===================================================================
--- code/branches/SOBv2_HS17/data/levels/SOB.oxw	2017-12-11 13:04:37 UTC (rev 11649)
+++ code/branches/SOBv2_HS17/data/levels/SOB.oxw	2017-12-11 13:14:15 UTC (rev 11650)
@@ -79,7 +79,7 @@
 	</Template>
 
 	<Template name=gumbaShootable>
-		<SOBGumbaBoss collisionType="dynamic" speed=40>
+		<SOBGumbaBoss collisionType="dynamic" speed=60>
 			<attached>
 				<Model mesh="Goomba.mesh" position="0,0,1" scale=3 pitch=90/> 				
 			</attached>

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-12-11 13:04:37 UTC (rev 11649)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-12-11 13:14:15 UTC (rev 11650)
@@ -114,7 +114,7 @@
         //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);
+        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>   (otherObject);
         SOBFlagstone*   flagstone   = orxonox_cast<SOBFlagstone*>   (otherObject);
         SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*> (otherObject);
         SOBFireball*    fireball    = orxonox_cast<SOBFireball*>    (otherObject);

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFlagstone.h
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFlagstone.h	2017-12-11 13:04:37 UTC (rev 11649)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFlagstone.h	2017-12-11 13:14:15 UTC (rev 11650)
@@ -28,7 +28,8 @@
 
 /**
     @file SOBFlagstone.h
-    @brief Declaration of the SOBFlagstone class. This class is used for the flag - for everz 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get.
+    @brief Declaration of the SOBFlagstone class. 
+            This class is used for the flag - for every 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get.
     @ingroup SOB
 */
 

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc	2017-12-11 13:04:37 UTC (rev 11649)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumba.cc	2017-12-11 13:14:15 UTC (rev 11650)
@@ -123,8 +123,12 @@
             dir = -1;
 
         Vector3 velocity = getVelocity();
+        if(velocity.z > -1 && velocity.z < 1)
+        {
+            velocity.x = dir*speed_;
+        }      
+
         velocity.z -= gravityAcceleration_*dt;
-        velocity.x = dir*speed_;
         setVelocity(velocity);
 
         lastPos_ = getPosition();

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc	2017-12-11 13:04:37 UTC (rev 11649)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.cc	2017-12-11 13:14:15 UTC (rev 11650)
@@ -30,7 +30,7 @@
 /**
     @file SOBGumbaBoss.cc
     @brief A Boss Gumba, which shoots small Gumbas
-*/
+**/
 
 #include "SOB.h"
 #include "SOBGumba.h"
@@ -53,9 +53,11 @@
     {
         RegisterObject(SOBGumbaBoss);
 
-        gumbaMaxTime_ = 1;
-        gumbaTime_ = 0;
-        maxGumbas = 2; //Max Gumbas spawnable by a Boss
+        gumbaMaxTime_   = 1;
+        gumbaTime_      = 0;
+        maxGumbas_      = 10; //Max Gumbas spawnable by a Boss
+        jumpTime_       = 0;
+        jumpTimeMax_    = 5;
         
     }
 
@@ -62,8 +64,17 @@
     
     bool SOBGumbaBoss::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
 
+        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>(otherObject);
+        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>(otherObject);
+
+        if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
+            gumba->destroyLater();
+            gumba->hasCollided_ = true;
+        }
+
+
         //Every object with mass -1 does not change the direction of the GumbaBoss. For example the ground floor! The other objects switch the direction of the GumbaBoss.
-        if (changeAllowed_ && otherObject->getMass() != -1) {
+        else if (changeAllowed_ && otherObject->getMass() != -1) {
             goesRight_ = !goesRight_;
             changeAllowed_ = false;
         }
@@ -77,6 +88,8 @@
     void SOBGumbaBoss::tick(float dt)
     {
         SUPER(SOBGumbaBoss, tick, dt);
+        gumbaTime_ += dt;
+        jumpTime_  += dt; 
 
         if (!changeAllowed_) {
             changedOn_+= dt;
@@ -88,7 +101,6 @@
             }
         }
     
-        gumbaTime_ += dt;
 
         if(gumbaTime_ > gumbaMaxTime_){ //Spawn Gumba
             int gumbaCounter=0;
@@ -102,7 +114,7 @@
             } 
 
 
-            if(gumbaCounter<maxGumbas){    //only maxGumbas are allowed at one time per Gumbaboss
+            if(gumbaCounter<maxGumbas_){    //only maxGumbas are allowed at one time per Gumbaboss
                 spawnGumba();
                 gumbaTime_ = 0;
             }
@@ -113,7 +125,14 @@
             dir = -1;
 
         Vector3 velocity = getVelocity();
-        velocity.z -= gravityAcceleration_*dt;
+        if(jumpTime_ > jumpTimeMax_){
+            velocity.z = speed_*15;
+            jumpTime_ = 0;
+        }
+        else{
+            velocity.z -= gravityAcceleration_*dt;
+        }
+
         velocity.x = dir*speed_;
         setVelocity(velocity);
 
@@ -131,9 +150,8 @@
         if (gumba != nullptr && center_ != nullptr)
         {
             gumba->addTemplate("gumbaShootable");
-            bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
-            gumba->setDirection(direction);
-            if(direction)
+            gumba->setDirection(goesRight_);
+            if(goesRight_)
             {
                 spawnpos.x+=20;
             }
@@ -147,7 +165,8 @@
         }
 
         Vector3 velocity = gumba->getVelocity();
-        velocity.z -= 100;
+        velocity.x += (2*goesRight_ -1) * 100;
+        velocity.z += 200;
         gumba->setVelocity(velocity);
      }
 }

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h	2017-12-11 13:04:37 UTC (rev 11649)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBGumbaBoss.h	2017-12-11 13:14:15 UTC (rev 11650)
@@ -55,8 +55,11 @@
         protected:
             float gumbaTime_;
             float gumbaMaxTime_;
-            int maxGumbas;
+            float jumpTimeMax_;
+            float jumpTime_;
+            int maxGumbas_;
 
+
            
     };
 }



More information about the Orxonox-commit mailing list