[Orxonox-commit 6870] r11491 - code/branches/SOBv2_HS17/src/modules/superorxobros

varxth at orxonox.net varxth at orxonox.net
Mon Oct 16 16:03:17 CEST 2017


Author: varxth
Date: 2017-10-16 16:03:17 +0200 (Mon, 16 Oct 2017)
New Revision: 11491

Modified:
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
Log:
improved power up of player

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-10-16 14:01:29 UTC (rev 11490)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-10-16 14:03:17 UTC (rev 11491)
@@ -109,19 +109,43 @@
             SOBGame->addMushroom(); // Tell the gametype to increase points
             mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once
 
+            Vector3 scale = {1.2, 1.2, 1.2};
+            this->setScale3D(scale);
+            /*if (this->hasPhysics() && this->collisionShape_ != nullptr)
+            {
+             this->collisionShape_->setScale3D(scale);
+            }*/
+
+        }
         //Check if otherObject is a Gumba (that walking enemies)
-        } else if (gumba != nullptr && !(gumba->hasCollided_)) {
 
-            //If player jumps on its head, kill it, else, kill the player
+         else if (gumba != nullptr && !(gumba->hasCollided_)) {
+
+            //If player doesn't jump on its head, kill it, else, kill the player
             if (getVelocity().z >= -20) {
-              Vector3 vel = getVelocity();
-              vel.y = -80;
-              vel.z = 200;
-              setVelocity(vel);
-              predead_=true; 
-              SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
-              SOBGame->setDone(true);
+                // If player hasn't a power up, he dies. Else he shrinks and the gumba dies.
+                if(!gotPowerUp_){
+                    Vector3 vel = getVelocity();
+                    vel.y = -80;
+                    vel.z = 200;
+                    setVelocity(vel);
+                    predead_=true; 
+                    SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+                    SOBGame->setDone(true);
+                } else{
+                    gotPowerUp_ = false;
+                    
+                    Vector3 scale = {1, 1, 1};
+                    this->setScale3D(scale);
+                    /*if (this->hasPhysics() && this->collisionShape_ != nullptr)
+                    {
+                     this->collisionShape_->setScale3D(scale);
+                    }*/
 
+                    gumba->destroyLater();
+                    gumba->hasCollided_ = true;
+                }
+
           } else {
             gumba->destroyLater();
             gumba->hasCollided_ = true;



More information about the Orxonox-commit mailing list