Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/CMakeLists.txt
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/CMakeLists.txt	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/CMakeLists.txt	(revision 11766)
@@ -9,7 +9,9 @@
   SOBHUDInfo.cc
   SOBGumba.cc
+  SOBFireball.cc
   SOBFlagstone.cc
   SOBCastlestone.cc
   SOBCoin.cc
+  SOBGumbaBoss.cc
 
 )
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.cc	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.cc	(revision 11766)
@@ -44,4 +44,5 @@
 #include "SOBFigure.h"
 #include "graphics/Camera.h"
+#include "Highscore.h"
 
 
@@ -49,5 +50,5 @@
 namespace orxonox
 {
-
+    bool newHighscore=0;
     RegisterUnloadableClass(SOB);
 
@@ -124,5 +125,5 @@
         GSLevel::startMainMenu();
         Deathmatch::end();
-    }
+}
 
     void SOB::restart() {
@@ -167,5 +168,10 @@
         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();
 
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.h	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.h	(revision 11766)
@@ -76,4 +76,7 @@
                 points_+=100;
             }
+            void addGumbaBoss() {
+                points_+=5000;
+            }
             void addPoints(int poi) {
                 points_+=poi;
@@ -103,4 +106,5 @@
 
             WeakPtr<SOBCenterpoint> center_;
+            bool newHighscore;
 
         protected:
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.cc	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.cc	(revision 11766)
@@ -23,4 +23,6 @@
  *      Julien Kindle
  *   Co-authors:
+ *      Noah Zarro
+ *      Theo von Arx
  *      
  *
@@ -39,10 +41,15 @@
 #include "graphics/Camera.h"
 #include "graphics/ParticleSpawner.h"
+#include <OgreMath.h>
 
 #include "SOBMushroom.h"
 #include "SOBGumba.h"
+#include "SOBGumbaBoss.h"
+#include "SOBFireball.h"
 #include "SOB.h"
 #include "SOBFlagstone.h"
 #include "SOBCastlestone.h"
+#include "SOBFireball.h"
+#include "Highscore.h"
 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
 
@@ -59,26 +66,35 @@
 
         //Vars for movement of player
-        moveUpPressed_ = false;
-        moveDownPressed_ = false;
-        moveLeftPressed_ = false;
-        moveDownPressed_ = false;
-        firePressed_ = false;
-        collDisZ_ = 0;
+        moveUpPressed_      = false;
+        moveDownPressed_    = false;
+        moveLeftPressed_    = false;
+        moveDownPressed_    = false;
+        firePressed_        = false;
+        collDisZ_           = 0;
+
         //Times and turning
-        timeSinceLastFire_ = 0.0;
-        lastSpeed_z = 0.0;
-        pitch_ = 0.0;
-        timeCounter_ = 0;
+        timeSinceLastFire_  = 0.0;
+        lastSpeed_z         = 0.0;
+        pitch_              = 0.0;
+        timeCounter_        = 0;
 
         //Properties of player
-        gotPowerUp_ = false;
-        isColliding_ = true;
-        particlespawner_ = NULL;
+
+        isColliding_        = true;
+        particlespawner_    = NULL;
 
         //Properties of players life
-        predead_ = false;
-        dead_ = false;
-        lvlEnded_ = false;
+        predead_            = false;
+        dead_               = false;
+        lvlEnded_           = false;
         reachedLvlEndState_ = 0;
+
+        // Properties concerning PowerUps and items
+        PowerUpCounter_     = 0;
+        maxPowerUp_         = 2;
+        FireballPower       = 2;
+        //Properties of fireing Fireballs, NOTE! fireballs are fired with the moveUP Key, not with the fire key
+        fireallowed_        = true;
+        firecooldown_       = 0;
 
         
@@ -97,39 +113,75 @@
 
         //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);
-        SOBFlagstone* flagstone = orxonox_cast<SOBFlagstone*>(otherObject);
-        SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*>(otherObject);
-
-        //Check if otherObject is a powerup
+        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);
+        SOB* SOBGame                = orxonox_cast<SOB*>            (getGametype()); 
+
+
+        //Check if otherObject is a powerup-mushroom
         if (mush != nullptr && !(mush->hasCollided_)) {
             otherObject->destroyLater();
-            gotPowerUp_ = true;
-            SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); //Get the Gametype
+
+            PowerUpCounter_++;
+            if(PowerUpCounter_ > maxPowerUp_)   PowerUpCounter_ = maxPowerUp_; // you had already the max
+            else                                this->changeClothes();
+
             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
+            
+            
+        }
+
+        
 
         //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 && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
+
+            //If player jumps on its head, kill the Gumba, 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(PowerUpCounter_ == 0){
+                    this->die();
+                } 
+                else{
+                    PowerUpCounter_--;
+                    this->changeClothes();
+
+                    gumba->destroyLater();
+                    gumba->hasCollided_ = true;
+                }
 
           } else {
             gumba->destroyLater();
             gumba->hasCollided_ = true;
-            SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
             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();
+                } 
+            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
@@ -137,5 +189,5 @@
         flagstone->hasCollided_ = true;
         reachedLvlEndState_ = 1;
-        SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+
         SOBGame->setDone(true);
         SOBGame->addPoints(flagstone->getPoints());
@@ -159,4 +211,30 @@
 }
 
+//Function to spawn the Fireball
+void SOBFigure::spawnFireball() {
+        SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
+
+         SOBFireball* ball = new SOBFireball(center_->getContext());
+         Vector3 spawnpos = this->getWorldPosition();
+         spawnpos.z += 0;
+
+        if (ball != nullptr && center_ != nullptr)
+        {
+            ball->addTemplate("fireball");
+            bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
+            ball->setDirection(direction);
+            if(direction)
+            {
+                spawnpos.x+=10;
+            }
+            else
+            {
+                spawnpos.x-=10;
+            }
+            ball->setPosition(spawnpos);
+
+        }
+     }
+
 //For those of you who don't have an idea: the tick function is called about 50 times/sec
 void SOBFigure::tick(float dt)
@@ -166,4 +244,5 @@
 
     bool inputAllowed = true;
+    //SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
 
     //the particle spawner that generates the fire from the backpack when pressed
@@ -174,5 +253,7 @@
             particlespawner_ = object;
         }
-    }
+
+    }
+    
 
 
@@ -190,8 +271,8 @@
     //if input blocked, then cancel every movement operation
     if (!inputAllowed) {
-        moveUpPressed_ = false;
-        moveDownPressed_ = false;
-        moveLeftPressed_ = false;
-        moveRightPressed_ = false;
+        moveUpPressed_      = false;
+        moveDownPressed_    = false;
+        moveLeftPressed_    = false;
+        moveRightPressed_   = false;
     }
 
@@ -204,4 +285,5 @@
     if (hasLocalController())
     {
+        SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
         Vector3 velocity = getVelocity();
         Vector3 position = getPosition();
@@ -212,5 +294,4 @@
         if (position.z < -100) {
             dead_ = true;
-            SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
             SOBGame->setDone(true);
         }
@@ -221,5 +302,5 @@
             velocity.z = 0;
             setVelocity(velocity);
-            SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+           
             if (firePressed_)
                 SOBGame->restart();
@@ -242,10 +323,10 @@
         else
             particlespawner_->setVisible(false); 
-
+        
 
         //If player hits space and collides against an object under him then jump
-        if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 7.75 && collDisZ_ <+ 8.25)) {
-            gravityAcceleration_ = 100.0;
-            velocity.z = 110; 
+        if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 0 && collDisZ_ <+ 10)) {
+            gravityAcceleration_ = 350;
+            velocity.z = 175; 
         }
 
@@ -274,4 +355,21 @@
         }
 
+        //If moveUp pressed, fire a fireball
+        if(moveUpPressed_ && (PowerUpCounter_ >= FireballPower) && fireallowed_)
+        {
+            spawnFireball();
+            fireallowed_  = false;
+            firecooldown_ = 0;
+        }
+
+        //Increase the firecooldown
+        if(firecooldown_> 0.5)
+        {
+            fireallowed_ = true;
+        }
+        if(!fireallowed_)
+        {
+            firecooldown_ += dt;
+        }
 
         //Again another EndOfLevel behavior
@@ -283,6 +381,15 @@
             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;
@@ -307,16 +414,11 @@
         }
 
-
-
-
-    }
-
-
+    }
 
     // Reset key variables
-    moveUpPressed_ = false;
-    moveDownPressed_ = false;
-    moveLeftPressed_ = false;
-    moveRightPressed_ = false;
+    moveUpPressed_      = false;
+    moveDownPressed_    = false;
+    moveLeftPressed_    = false;
+    moveRightPressed_   = false;
 
     isColliding_ = false;
@@ -364,3 +466,34 @@
 
 
-}
+
+// PRE: name is an existing name of a material. Example orxo_material for orxo_material.material in data_extern/materials
+//      !!! PowerUpCounter_ has to be modified before changing the clothes!!!
+// POST: clothes of body of player are changed to name
+void SOBFigure::changeClothes(){
+            // clothes: white (basic), red (one PowerUp), orange (Fireball enabled)
+            std::string clothes[] = {"orxo_material", "orxo_material_gross", "orxo_material_fire"};
+
+            std::set<WorldEntity*> attachedObjects = this->getAttachedObjects();
+            std::set<WorldEntity*>::iterator it;
+            for (it = attachedObjects.begin(); it != attachedObjects.end(); ++it)
+            {
+                Model* FiguresModel = orxonox_cast<Model*>(*it);
+                if (FiguresModel != nullptr)
+                {
+                    FiguresModel->setSubMaterial(clothes[PowerUpCounter_] , 4); // 4 is the body
+                }
+            }   
+}
+// PRE:
+// POST: Player jumps out of the game, game is finished and can be restarted.
+void SOBFigure::die(){
+    Vector3 vel = getVelocity();
+    vel.y = -80;
+    vel.z = 200;
+    setVelocity(vel);
+    predead_= true; 
+    SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+    SOBGame->setDone(true);
+}
+
+}
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.h	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.h	(revision 11766)
@@ -46,4 +46,7 @@
             virtual void boost(bool boost) override;
             virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+            void changeClothes();
+            void spawnFireball();
+            void die();
 
             bool dead_;
@@ -54,5 +57,6 @@
 
             //Soooo many declarations
-            bool gotPowerUp_;
+            bool fireallowed_;
+
             bool moveUpPressed_;
             bool moveDownPressed_;
@@ -63,8 +67,12 @@
             float timeSinceLastFire_;
             float lastSpeed_z;
+            float firecooldown_;
             SOBCenterpoint* sobcenterpoint;
             float pitch_;
             bool isColliding_;
             WorldEntity* particlespawner_;
+            int PowerUpCounter_;
+            int maxPowerUp_;
+            int FireballPower;
             int sgn(float x);
             int reachedLvlEndState_;
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.cc	(revision 11766)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.cc	(revision 11766)
@@ -0,0 +1,209 @@
+    /*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Theo von Arx
+ *      Noah Zarro
+ *   Co-authors:
+ *      
+ *
+ */
+
+/**
+    @file SOBFireball.cc
+    @brief Fireballs are the Projectile of the Fireflower Powerup
+*/
+
+#include "SOBFireball.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SOBFigure.h"
+#include "SOBGumba.h"
+#include "SOBGumbaBoss.h"    
+#include "SOB.h"    
+#include "util/Output.h"
+#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
+#include "graphics/ParticleSpawner.h"
+
+
+
+
+namespace orxonox
+{
+    RegisterClass(SOBFireball);
+
+    SOBFireball::SOBFireball(Context* context) : MovableEntity(context)
+    {
+        RegisterObject(SOBFireball);
+
+        attachedToFigure_ = false;
+        setAngularFactor(0.0);
+        figure_ = nullptr;
+        this->enableCollisionCallback();
+        gravityAcceleration_ = 350.0;
+
+        speed_ = 0;
+        hasCollided_=false;
+        lastPos_ = getPosition();
+        lastPos_.x -= 20;
+        changeAllowed_ = true;
+        changedOn_ = 0.0;
+        goesRight_ = true;
+        collDisX_ = 0;
+        collDisZ_ = 0;
+        hitCounter_ = 0;
+        particlespawner_ = NULL ;
+
+
+
+   
+
+    }
+
+    
+
+    void SOBFireball::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SOBFireball, XMLPort, xmlelement, mode);
+        XMLPortParam(SOBFireball, "speed", setSpeed, getSpeed, xmlelement, mode);
+
+
+    }
+
+    void SOBFireball::setDirection(const bool direction)
+    {
+        if(direction)
+        {
+            goesRight_=true;
+        }
+        else
+        {
+            goesRight_=false;
+        }
+    }
+
+    
+    bool SOBFireball::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
+        collDisX_ = getPosition().x - contactPoint.getPositionWorldOnB().getX();
+        collDisZ_ = getPosition().z - contactPoint.getPositionWorldOnB().getZ();
+
+        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>       (otherObject);
+        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>   (otherObject);
+
+        if(gumbaBoss != nullptr && !(gumba->hasCollided_))  //Fireballs can't destroy GumbaBosses, they get destroyed themselves instead
+        {
+            this->destroyLater();
+            this->hasCollided_ = true;
+        }
+
+
+        if(gumba!=nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) //if other object is a Gumba, kill the Gumba and add score and destroy the fireball
+        {
+            gumba->destroyLater();
+            gumba->hasCollided_ = true;
+            SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+            SOBGame->addGumba();
+            this->destroyLater();
+            this->hasCollided_ = true;
+        }
+
+
+         //collision with either top or bottom of a block
+        else if(changeAllowed_ && (abs(collDisX_)<=abs(collDisZ_)))
+        {
+            changeAllowed_ = false;
+            Vector3 velocity = getVelocity();
+            velocity.z = -velocity.z;
+     
+
+            setVelocity(velocity);
+        }
+
+        //collision with the vertical side of a block 
+        else if(changeAllowed_ && (abs(collDisX_)>abs(collDisZ_))) 
+        {
+            changeAllowed_ = false;
+            goesRight_=!goesRight_;
+        }
+
+        hitCounter_++;
+        
+        collDisZ_=0;
+        collDisX_=0;
+
+        return true;
+    }
+
+
+    void SOBFireball::setFigure(SOBFigure* newFigure)
+    {
+        figure_ = newFigure;
+    }
+
+
+
+    void SOBFireball::tick(float dt)
+    {
+        SUPER(SOBFireball, tick, dt);
+
+        //the particle spawner that generates the fire from the backpack when pressed
+        if (particlespawner_ == NULL) {
+            for (WorldEntity* object : this->getAttachedObjects())
+            {
+               if (object->isA(Class(ParticleSpawner)))
+                particlespawner_ = object;
+            }
+
+        }
+
+        if(particlespawner_ != NULL)
+            particlespawner_->setVisible(true);
+        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.2) {
+                changeAllowed_ = true;
+                changedOn_ = 0.0;
+
+            }
+        
+        }
+            int dir = 1;
+            if (!goesRight_)
+                dir = -1;
+
+            Vector3 velocity = getVelocity();
+            velocity.z -= gravityAcceleration_*dt;
+            velocity.x = dir*speed_;
+            velocity.y = 0;
+            if(hitCounter_ >= 3) velocity.y = 0.1*speed_;
+            setVelocity(velocity);
+
+            lastPos_ = getPosition();
+
+            if(abs(this->getPosition().z) > 1000) delete this;
+        
+    }
+    
+
+
+}
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.h	(revision 11766)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.h	(revision 11766)
@@ -0,0 +1,85 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Theo von Arx
+        Noah Zarro
+ *   Co-authors:
+ *      
+ *
+ */
+
+/**
+    @file SOBFireball.h
+    @brief Declaration of the SOBFireball class. Fireballs are the Projectile of the Fireflower Powerup
+    @ingroup SOB
+*/
+
+#ifndef _SOBFireball_H__
+#define _SOBFireball_H__
+
+#include "superorxobros/SOBPrereqs.h"
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+    class _SOBExport SOBFireball : public MovableEntity
+    {
+        public:
+            SOBFireball(Context* context);
+            virtual ~SOBFireball() {}
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+            virtual void setFigure(SOBFigure* newFigure);
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+            virtual void tick(float dt) override;
+            void setDirection(const bool direction);
+          
+            bool attachedToFigure_;
+
+            void setSpeed(const float speed)
+                { this->speed_ = speed; }
+            float getSpeed() const
+                { return speed_; }
+
+            bool hasCollided_;
+        protected:
+            float gravityAcceleration_;
+            float speed_;
+            WeakPtr<SOBFigure> figure_;
+            Vector3 lastPos_;
+            bool goesRight_;
+            bool changeAllowed_;
+            float changedOn_;
+            int hitCounter_;
+            WorldEntity* particlespawner_;
+
+ 
+
+
+            float collDisX_;    
+            float collDisZ_;
+           
+    };
+}
+
+#endif /* _SOBFireball_H__ */
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFlagstone.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFlagstone.h	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFlagstone.h	(revision 11766)
@@ -29,5 +29,6 @@
 /**
     @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
 */
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.cc	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.cc	(revision 11766)
@@ -60,4 +60,7 @@
         changeAllowed_ = true;
         changedOn_ = 0.0;
+        creator_ = nullptr;
+        maxLifetime_ = 10;
+        lifetime_ = 0;
         
     }
@@ -91,5 +94,21 @@
     }
 
+    void SOBGumba::setDirection(const bool direction)
+    {
+        if(direction)
+        {
+            goesRight_=true;
+        }
+        else
+        {
+            goesRight_=false;
+        }
+    }
 
+    void SOBGumba::die(){
+        Vector3 velocity = this->getVelocity();
+        velocity.y = speed_;
+        this->setVelocity(velocity);
+    }
 
     void SOBGumba::tick(float dt)
@@ -100,5 +119,5 @@
             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.200) {
+            if (changedOn_> 0.400) {
                 changeAllowed_ = true;
                 changedOn_ = 0.0;
@@ -106,5 +125,5 @@
             }
         }
-        
+    
 
         int dir = 1;
@@ -113,11 +132,25 @@
 
         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();
+
+        if (creator_ != nullptr)
+        {
+            lifetime_ += dt;
+            if(lifetime_>maxLifetime_)
+            {
+                
+            }
+        }
+
+        if(abs(this->getPosition().z) > 1000) delete this;
+
     }
-
-
 }
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.h	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.h	(revision 11766)
@@ -51,4 +51,6 @@
             virtual void tick(float dt) override;
 
+            void setDirection(const bool direction);
+            void die();
           
             bool attachedToFigure_;
@@ -60,4 +62,5 @@
 
             bool hasCollided_;
+            SOBGumbaBoss* creator_;
         protected:
             float gravityAcceleration_;
@@ -68,4 +71,7 @@
             bool changeAllowed_;
             float changedOn_;
+            float maxLifetime_;
+            float lifetime_;
+
            
     };
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumbaBoss.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumbaBoss.cc	(revision 11766)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumbaBoss.cc	(revision 11766)
@@ -0,0 +1,189 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Noah Zarro
+ *      Theo von Arx
+ *   Co-authors:
+ *      
+ *
+ */
+
+/**
+    @file SOBGumbaBoss.cc
+    @brief A Boss Gumba, which shoots small Gumbas
+**/
+
+#include "SOB.h"
+#include "SOBGumba.h"
+#include "SOBGumbaBoss.h"
+#include "SOBFireball.h"
+#include "SOBFigure.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Output.h"
+#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
+
+
+
+namespace orxonox
+{
+    RegisterClass(SOBGumbaBoss);
+
+    SOBGumbaBoss::SOBGumbaBoss(Context* context) : SOBGumba(context)
+    {
+        RegisterObject(SOBGumbaBoss);
+
+        gumbaMaxTime_   = 1;  // time after which a Gumba is shot
+        gumbaTime_      = 0;  // time since last gumba was shot
+        maxGumbas_      = 50; // Max Gumbas spawnable by a Boss
+        jumpTimeMax_    = 5;  // time after which the gumba boss jumps
+        jumpTime_       = 0;  // time since last jump of gumba boss
+        
+    }
+
+    // PRE: otherObject collides with this.
+    // POST: collision is handled: velocity changed, small gumbas murdered
+    bool SOBGumbaBoss::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
+
+        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>(otherObject);
+        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>(otherObject);
+
+        // if boss collides with small gumbas, destroy them.
+        if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
+            gumba->die();
+        }
+
+
+        //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.
+        else if (changeAllowed_ && otherObject->getMass() != -1) {
+            goesRight_ = !goesRight_;
+            changeAllowed_ = false;
+        }
+
+        return true;
+    }
+
+
+
+    // POST: done what was to do in a time dt
+    void SOBGumbaBoss::tick(float dt)
+    {
+        SUPER(SOBGumbaBoss, tick, dt);
+
+        // increase timers:
+        gumbaTime_ += dt;
+        jumpTime_  += dt; 
+
+        // set y-component of position of gumba boss to 0, so he doesn't fall in to the nothing
+        Vector3 position = getPosition();
+        position.y = 0;
+        setPosition(position);
+
+
+        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.200) {
+                changeAllowed_ = true;
+                changedOn_ = 0.0;
+
+            }
+        }
+    
+
+        if(gumbaTime_ > gumbaMaxTime_){ //Spawn Gumba
+            int gumbaCounter=0;
+
+            for (SOBGumba*  gumbaInstance : ObjectList<SOBGumba>())
+            {
+                if (gumbaInstance != nullptr && gumbaInstance->creator_==this)
+                {
+                    gumbaCounter++;
+                }
+            } 
+
+
+            if(gumbaCounter<maxGumbas_){    //only maxGumbas are allowed at one time per Gumbaboss
+                spawnGumba();
+                gumbaTime_ = 0;
+            }
+        }
+
+        int dir = 1;
+        if (!goesRight_)
+            dir = -1;
+
+        // 
+        if(getPosition().x < 1640)
+            dir = 1;
+        else if (getPosition().x > 1750)
+            dir = -1;
+
+        //change velocity
+        Vector3 velocity = getVelocity();
+        if(jumpTime_ > jumpTimeMax_){ // jump if the time has come.
+            velocity.z = speed_*15;
+            jumpTime_ = 0;
+        }
+        else{
+            velocity.z -= gravityAcceleration_*dt;
+        }
+        velocity.x = dir*speed_;
+        setVelocity(velocity);
+
+        lastPos_ = getPosition();
+
+    }
+
+    // spawn gumbas
+    void SOBGumbaBoss::spawnGumba() {
+        SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
+
+         SOBGumba* gumba = new SOBGumba(center_->getContext());
+         Vector3 spawnpos = this->getWorldPosition();
+         gumba->creator_=this;
+
+         // we can shoot a gumba!
+        if (gumba != nullptr && center_ != nullptr)
+        {
+            gumba->addTemplate("gumbaShootable");
+            gumba->setDirection(goesRight_);
+            if(goesRight_)
+            {
+                spawnpos.x+=20;
+            }
+            else
+            {
+                spawnpos.x-=20;
+            }
+            spawnpos.z+=15;
+            gumba->setPosition(spawnpos);
+
+        }
+
+        Vector3 velocity = gumba->getVelocity();
+        velocity.x += (2*goesRight_ -1) * 100;
+        velocity.z += 200;
+        gumba->setVelocity(velocity);
+     }
+}
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumbaBoss.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumbaBoss.h	(revision 11766)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumbaBoss.h	(revision 11766)
@@ -0,0 +1,68 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Noah Zarro
+ *      Theo von Arx
+ *   Co-authors:
+ *      
+ *
+ */
+
+/**
+    @file SOBGumbaBoss.h
+    @brief Declaration of the SOBGumbaBoss class. GumbaBosss are the enemie mushrooms - pretty sure it's written Goomba but, naaah
+    @ingroup SOB
+*/
+
+#ifndef _SOBGumbaBoss_H__
+#define _SOBGumbaBoss_H__
+
+#include "superorxobros/SOBPrereqs.h"
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+    class _SOBExport SOBGumbaBoss : public SOBGumba
+    {
+        public:
+            SOBGumbaBoss(Context* context);
+            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+            virtual void tick(float dt) override;
+
+            void spawnGumba();
+
+
+        protected:
+            float gumbaTime_;
+            float gumbaMaxTime_;
+            float jumpTimeMax_;
+            float jumpTime_;
+            int maxGumbas_;
+
+
+
+           
+    };
+}
+
+#endif /* _SOBGumbaBoss_H__ */
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBPrereqs.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBPrereqs.h	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBPrereqs.h	(revision 11766)
@@ -76,4 +76,5 @@
     class SOBHUDInfo;
     class SOBGumba;
+    class SOBGumbaBoss;
     class SOBFlagstone;
     class SOBCastlestone;
Index: code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBQBlock.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBQBlock.cc	(revision 11763)
+++ code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBQBlock.cc	(revision 11766)
@@ -39,4 +39,6 @@
 #include "SOBMushroom.h"
 #include "SOBCoin.h"
+#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
+
 
 namespace orxonox
@@ -62,5 +64,6 @@
         //If you hit the QBlock, the visibility of all attached objects get inverted! Pretty easy way to create changing blocks :)
         float v_z = otherObject->getVelocity().z;
-        if (!used_ && v_z > 50.0) {
+        int collDisZ_ = getPosition().z - contactPoint.getPositionWorldOnB().getZ();
+        if (!used_ && v_z > 50.0 && collDisZ_ > 0) {
             used_ = true;
 
