Index: /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
===================================================================
--- /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	(revision 11594)
+++ /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	(revision 11595)
@@ -21,7 +21,6 @@
  *
  *   Author:
- *      Florian Zinggeler
- *   Co-authors:
- *      ...
+ *      Leo Mehr Holz
+ *      Pascal Schärli
  *
  */
@@ -60,30 +59,29 @@
     {
         RegisterObject(FlappyOrx);
-        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
         this->center_ = nullptr;
-        bEndGame = false;
-        lives = 1;
-        level = 0;
-        point = 0;
-        bShowLevel = false;
-        sDeathMessage = "Welcome to FlappyOrx";
+        point = 0;                          //number of cleared tubes
         bIsDead = true;
-        this->spawnDistance=200;
-        this->tubeOffsetX=500;
-        this->setHUDTemplate("FlappyOrxHUD");
-        firstGame = true;
-    }
+        firstGame = true;                   //needed for the HUD
+
+        spawnDistance=200;                  //distance between tubes
+        tubeOffsetX=500;                    //tube offset (so that we can't see them spawn)
+        setHUDTemplate("FlappyOrxHUD");
+    }
+
 
     void FlappyOrx::updatePlayerPos(int x){
 
+        //Spawn a new Tube when the spawn distance is reached
         if(this->tubes.size()==0||x-tubes.back()+tubeOffsetX>spawnDistance){
             spawnTube();
             this->tubes.push(x+tubeOffsetX);
         }
+        //Delete Tubes when we pass through them
         if(this->tubes.size()!=0&&x>this->tubes.front()){
             this->tubes.pop();
             levelUp();
         }
-        while((this->asteroids.front())->getPosition().x<x-300){
+        //Delete Asteroids which are not visible anymore
+        while((this->asteroids.front())->getPosition().x<x-tubeOffsetX){
             MovableEntity* deleteMe = asteroids.front();
             asteroids.pop();
@@ -92,17 +90,14 @@
     }
 
-    void FlappyOrx::levelUp()
-    {
+    //Gets called when we pass through a Tube
+    void FlappyOrx::levelUp(){
         point++;
-        spawnDistance = 300-3*point;
-        getPlayer()->setSpeed(100+.5*point);
-        toggleShowLevel();
-        //showLevelTimer.setTimer(3.0f, false, createExecutor(createFunctor(&FlappyOrx::toggleShowLevel, this)));
-    }
-
-    FlappyOrxShip* FlappyOrx::getPlayer()
-    {
-        if (player == nullptr)
-        {
+        spawnDistance = 300-3*point;            //smaller spawn Distance
+        getPlayer()->setSpeed(100+.5*point);    //increase speed
+    }
+
+    //Returns our Ship
+    FlappyOrxShip* FlappyOrx::getPlayer(){
+        if (player == nullptr){
             for (FlappyOrxShip* ship : ObjectList<FlappyOrxShip>()) {
                 player = ship;
@@ -112,38 +107,42 @@
     }
 
-    void FlappyOrx::spawnTube()
-    {
-        int space = 120;
-        int height = (float(rand())/RAND_MAX-0.5)*(280-space);
-           
+    //Spawn new Tube
+    void FlappyOrx::spawnTube(){
         if (getPlayer() == nullptr)
             return;
 
+        int space = 120;    //vertical space between top and bottom tube
+        int height = (float(rand())/RAND_MAX-0.5)*(280-space);  //Randomize height
+           
         Vector3 pos = player->getPosition();
 
-        asteroidField(pos.x+tubeOffsetX,height-space/2,0.8);
-        asteroidField(pos.x+tubeOffsetX,height+space/2,-0.8);   
-    }
-
+        //create the two Asteroid fields (Tubes)
+        asteroidField(pos.x+tubeOffsetX,height-space/2,0.8);  //bottom  
+        asteroidField(pos.x+tubeOffsetX,height+space/2,-0.8); //top
+    }
+
+    //Creates a new asteroid Field
     void FlappyOrx::asteroidField(int x, int y, float slope){
-        int r = 20;
-        int noadd = 0;
-
-        ClearAsteroids();
+        int r = 20;     //Radius of added Asteroids
+        int noadd = 0;  //how many times we failed to add a new asteroid
+
+        ClearAsteroids();   //Delete Asteroids
         Circle newAsteroid = Circle();
         newAsteroid.x=x;
         newAsteroid.y=y;
         newAsteroid.r=r;
-        addIfPossible(newAsteroid);
+        addIfPossible(newAsteroid); //Add Asteroid at peak
+
+        //Fill up triangle with asteroids
         while(r>0){
             if(slope>0)
-                newAsteroid.y=float(rand())/RAND_MAX*(150+y)-150;
+                newAsteroid.y=float(rand())/RAND_MAX*(150+y)-150;   //create asteroid on bottom
             else
-                newAsteroid.y=float(rand())/RAND_MAX*(150-y)+y;
+                newAsteroid.y=float(rand())/RAND_MAX*(150-y)+y;     //create asteroid on top
             
             newAsteroid.x=x+(float(rand())/RAND_MAX-0.5)*(y-newAsteroid.y)/slope;
             newAsteroid.r=r;
            
-            int i = addIfPossible(newAsteroid);
+            int i = addIfPossible(newAsteroid); //Add Asteroid if it doesn't collide
             if(i==0)
                 noadd++;
@@ -157,12 +156,9 @@
     }
 
-    void deleteAsteroid(MovableEntity* asteroid){
-        //center_->getContext().getObjectList().removeElement(asteroid);
-    }
-
+    //Create a new Asteroid
     void FlappyOrx::createAsteroid(Circle &c){
         MovableEntity* newAsteroid = new MovableEntity(this->center_->getContext());
 
-
+        //Add Model fitting the Size of the Asteroid
         if(c.r<=5)
             newAsteroid->addTemplate(Asteroid5[rand()%NUM_ASTEROIDS]);
@@ -174,22 +170,18 @@
             newAsteroid->addTemplate(Asteroid20[rand()%NUM_ASTEROIDS]);
         
+        //Set position
         newAsteroid->setPosition(Vector3(c.x, 0, c.y));
+
+        //Randomize orientation
         newAsteroid->setOrientation(Vector3::UNIT_Z, Degree(rand()%360));
         newAsteroid->setOrientation(Vector3::UNIT_Y, Degree(rand()%360));
 
+        //add to Queue (so that we can delete it again)
         asteroids.push(newAsteroid);
-
-
-    }
-
-    void FlappyOrx::setCenterpoint(FlappyOrxCenterPoint* center)
-    {
+    }
+
+    void FlappyOrx::setCenterpoint(FlappyOrxCenterPoint* center){
         this->center_ = center;
     }
-
-    void FlappyOrx::costLife()
-    {
-        
-    };
 
     bool FlappyOrx::isDead(){
@@ -201,5 +193,4 @@
         if(not value){
             point = -1;
-            level=-1;
             levelUp();
         }
@@ -221,9 +212,10 @@
     }
 
-
+    //RIP
     void FlappyOrx::death(){
         bIsDead = true;
         firstGame = false;
         
+        //Set randomized deathmessages
         if(point<10)        sDeathMessage = DeathMessage10[rand()%(DeathMessage10.size())];
         else if(point<30)   sDeathMessage = DeathMessage30[rand()%(DeathMessage30.size())];
@@ -231,7 +223,5 @@
         else                sDeathMessage = DeathMessageover50[rand()%(DeathMessageover50.size())];
         
-        orxout()<<"message: "<<sDeathMessage<<std::endl;
-
-
+        //Update Highscore
         if (Highscore::exists()){
                     int score = this->getPoints();
@@ -239,10 +229,10 @@
                         Highscore::getInstance().storeHighscore("Flappy Orx",score);
         }
-        while (!tubes.empty())
-        {
+
+        //Delete all Tubes and asteroids
+        while (!tubes.empty()){
             tubes.pop();
         }
-        while (!asteroids.empty())
-        {
+        while (!asteroids.empty()){
             MovableEntity* deleteMe = asteroids.front();
             asteroids.pop();
Index: /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
===================================================================
--- /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	(revision 11594)
+++ /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	(revision 11595)
@@ -90,4 +90,6 @@
             bool isDead();
             void setDead(bool value);
+
+            FlappyOrxShip* getPlayer();
             
             int lives;
@@ -102,5 +104,5 @@
             int spawnDistance;
             int tubeOffsetX;
-
+            
         private:
             void toggleShowLevel(){bShowLevel = !bShowLevel;}
@@ -144,5 +146,4 @@
             
 
-            FlappyOrxShip* getPlayer();
             WeakPtr<FlappyOrxCenterPoint> center_;
             WeakPtr<FlappyOrxShip> player;
Index: /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc
===================================================================
--- /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc	(revision 11594)
+++ /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc	(revision 11595)
@@ -104,5 +104,9 @@
                             break;
                             case 3:
-                                message = "Press space to restart.";
+                                int time = this->FlappyOrxGame->getPlayer()->timeUntilRespawn();
+                                if(time<=0)
+                                    message = "Press space to restart.";
+                                else
+                                    message = "Please wait "+multi_cast<std::string>(time)+" seconds.";
                             break;
                         }
Index: /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
===================================================================
--- /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	(revision 11594)
+++ /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	(revision 11595)
@@ -40,4 +40,5 @@
 #include "weapons/projectiles/Projectile.h"
 #include <math.h> 
+#include <ctime>
 
 namespace orxonox
@@ -53,4 +54,5 @@
         this->gravity = 1;
         isDead = true;
+        deathTime = 0;
         
     }
@@ -128,6 +130,12 @@
     void FlappyOrxShip::moveRightLeft(const Vector2& value){}
 
+    int FlappyOrxShip::timeUntilRespawn(){
+        return 2-time(0)+deathTime;
+    }
+
     void FlappyOrxShip::boost(bool boost){
-        if(isDead){
+
+    
+        if(isDead&&timeUntilRespawn()<=0){
             isDead = false;
             getGame()->setDead(false);
@@ -156,4 +164,8 @@
     {
         isDead = true;
+
+        deathTime = time(0);
+
+        orxout()<<"death time: "<<deathTime<<std::endl;
         Vector3 pos = getPosition();
         pos.x = 0;
Index: /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h
===================================================================
--- /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h	(revision 11594)
+++ /code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h	(revision 11595)
@@ -74,4 +74,6 @@
                 { return this->UpwardThrust; }
             virtual void updateLevel();
+            virtual int timeUntilRespawn();
+            
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
@@ -85,4 +87,5 @@
             bool isDead;
             float speed, UpwardThrust, gravity;
+            long deathTime;
             struct Velocity
             {
