Index: code/branches/FlappyOrx_HS17/src/modules/flappyorx/CMakeLists.txt
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/CMakeLists.txt	(revision 11521)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/CMakeLists.txt	(revision 11529)
@@ -7,4 +7,5 @@
   FlappyOrxWeaponEnemy.cc
   FlappyOrxHUDinfo.cc
+  FlappyOrxAsteroid.cc
 END_BUILD_UNIT
 )
Index: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	(revision 11521)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	(revision 11529)
@@ -47,4 +47,5 @@
 #include "FlappyOrxCenterPoint.h"
 #include "FlappyOrxShip.h"
+#include "FlappyOrxAsteroid.h"
 
 #include "core/command/ConsoleCommand.h"
@@ -67,32 +68,25 @@
         multiplier = 1;
         b_combo = false;
-        
+        this->spawnDistance=300;
+        this->tubeOffsetX=500;
         this->setHUDTemplate("FlappyOrxHUD");
     }
 
+    void FlappyOrx::updatePlayerPos(int x){
+        if(this->tubes.size()==0||x-this->tubes.back()-tubeOffsetX>spawnDistance){
+            spawnTube();
+            this->tubes.push(x+tubeOffsetX);
+        }
+        if(this->tubes.size()!=0&&x>this->tubes.front()){
+            this->tubes.pop();
+            levelUp();
+        }
+    }
+
     void FlappyOrx::levelUp()
     {
         level++;
-        if (getPlayer() != nullptr)
-        {
-            for (int i = 0; i < 7; i++)
-            {
-
-                WeakPtr<ExplosionPart> chunk5 = new ExplosionPart(this->center_->getContext());
-                chunk5->setPosition(this->center_->getPosition());
-                chunk5->setVelocity(Vector3(1000, 0, 0));  //player->getVelocity()
-                chunk5->setScale(10);
-                chunk5->setEffect1("Orxonox/explosion2b");
-                chunk5->setEffect2("Orxonox/smoke6");
-                chunk5->setMinSpeed(0);
-                chunk5->setMaxSpeed(0);
-                chunk5->Explode();
-
-            }
-        }
-        addPoints(multiplier * 42);
-        multiplier *= 2;
-        toggleShowLevel();
-        showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&FlappyOrx::toggleShowLevel, this)));
+        //toggleShowLevel();
+        //showLevelTimer.setTimer(3.0f, false, createExecutor(createFunctor(&FlappyOrx::toggleShowLevel, this)));
     }
 
@@ -108,5 +102,62 @@
     }
 
-
+    void FlappyOrx::spawnTube()
+    {
+        int space = 90;
+        int height = (float(rand())/RAND_MAX-0.5)*(280-space);
+           
+        if (getPlayer() == nullptr)
+            return;
+
+        Vector3 pos = player->getPosition();
+
+        asteroidField(pos.x+tubeOffsetX,height-space/2,0.8);
+        asteroidField(pos.x+tubeOffsetX,height+space/2,-0.8);   
+    }
+
+    void FlappyOrx::asteroidField(int x, int y, float slope){
+        int r = 20;
+        int noadd = 0;
+
+        ClearAsteroids();
+        Circle newAsteroid = Circle();
+        while(r>0){
+            if(slope>0)
+                newAsteroid.y=float(rand())/RAND_MAX*(150+y)-150;
+            else
+                newAsteroid.y=float(rand())/RAND_MAX*(150-y)+y;
+            
+            newAsteroid.x=x+(float(rand())/RAND_MAX-0.5)*(y-newAsteroid.y)/slope;
+            newAsteroid.r=r;
+           
+            int i = addIfPossible(newAsteroid);
+            if(i==0)
+                noadd++;
+            else if(i==2)
+                r=0;
+            if(noadd>=5){
+                noadd=0;
+                r-=5;
+            }
+        }
+    }
+
+    void FlappyOrx::createAsteroid(Circle &c){
+        orxout() << "created Asteroid at x="<<c.x<<" y="<<c.y << std::endl;
+        MovableEntity* newAsteroid = new MovableEntity(this->center_->getContext());
+        if(c.r<=5)
+            newAsteroid->addTemplate(Asteroid5[rand()%6]);
+        else if(c.r<=10)
+            newAsteroid->addTemplate(Asteroid10[rand()%6]);
+        else if(c.r<=15)
+            newAsteroid->addTemplate(Asteroid15[rand()%6]);
+        else
+            newAsteroid->addTemplate(Asteroid20[rand()%6]);
+        
+        newAsteroid->setPosition(Vector3(c.x, 0, c.y));
+        newAsteroid->setOrientation(Vector3::UNIT_Z, Degree(rand()%360));
+        newAsteroid->setOrientation(Vector3::UNIT_Y, Degree(rand()%360));
+
+    }
 
     void FlappyOrx::setCenterpoint(FlappyOrxCenterPoint* center)
Index: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	(revision 11521)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	(revision 11529)
@@ -41,6 +41,23 @@
 #include "tools/Timer.h"
 
+
 namespace orxonox
 {
+
+    struct Circle{
+        int r;
+        int x;
+        int y;
+        Circle(int new_r, int new_x, int new_y){
+            r=new_r;
+            x=new_x;
+            y=new_y;
+        }
+        Circle(){
+            r=0;
+            x=0;
+            y=0;
+        }
+    };
 
     class _FlappyOrxExport FlappyOrx : public Deathmatch
@@ -53,6 +70,9 @@
             virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
 
-            void spawnEnemy();
-
+            void updatePlayerPos(int x);
+            void createAsteroid(Circle &c);
+            void asteroidField(int x, int y, float slope);
+            void spawnTube();
+            
             void setCenterpoint(FlappyOrxCenterPoint* center);
 
@@ -71,6 +91,48 @@
             bool bEndGame;
             bool bShowLevel;
+            std::queue<int> tubes;
+            int spawnDistance;
+            int tubeOffsetX;
         private:
             void toggleShowLevel(){bShowLevel = !bShowLevel;}
+
+            const static int nAst = 7;
+            Circle Asteroids[nAst];
+
+            void ClearAsteroids(){
+                for(int i = 0; i<this->nAst; i++){
+                    Asteroids[i].r=0;
+                }
+            }
+
+            
+            bool Collision(Circle &c1, Circle &c2){
+                if(c1.r==0 || c2.r==0)
+                    return false;
+                int x = c1.x - c2.x;
+                int y = c1.y - c2.y;
+                int r = c1.r + c2.r;
+
+                return x*x+y*y<r*r*1.5;
+            }
+
+            int addIfPossible(Circle c){
+                int i;
+                for(i=0; i<this->nAst && this->Asteroids[i].r!=0;i++){
+                    if(Collision(c,this->Asteroids[i])){
+                        return 0;
+                    }
+                }
+                if(i==nAst)
+                    return 2;
+                this->Asteroids[i].x=c.x;
+                this->Asteroids[i].y=c.y;
+                this->Asteroids[i].r=c.r;
+                createAsteroid(c);
+                return 1;
+            }
+            
+            
+
             FlappyOrxShip* getPlayer();
             WeakPtr<FlappyOrxCenterPoint> center_;
@@ -84,4 +146,11 @@
             int point;
             bool b_combo;
+            std::string Asteroid5[6] = {"Asteroid3_1","Asteroid3_2","Asteroid3_3","Asteroid3_4","Asteroid3_5","Asteroid3_6"};
+            std::string Asteroid10[6] = {"Asteroid6_1","Asteroid6_2","Asteroid6_3","Asteroid6_4","Asteroid6_5","Asteroid6_6"};
+            std::string Asteroid15[6] = {"Asteroid9_1","Asteroid9_2","Asteroid9_3","Asteroid9_4","Asteroid9_5","Asteroid9_6"};
+            std::string Asteroid20[6] = {"Asteroid12_1","Asteroid12_2","Asteroid12_3","Asteroid12_4","Asteroid12_5","Asteroid12_6"};
+
+
+
     };
 }
Index: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	(revision 11521)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	(revision 11529)
@@ -73,13 +73,18 @@
             }
             Vector3 pos = getPosition();
-            velocity.y += gravity;
+
+            getGame()->updatePlayerPos(pos.x);
+            
+
+            velocity.y += gravity*dt;
             if(isFlapping){
                 isFlapping = false;
-                velocity.y = -UpwardThrust;
+                if(pos.z > -150)
+                    velocity.y = -UpwardThrust;
             }
 
             pos += Vector3(speed + velocity.x, 0, velocity.y) * dt;
             
-            if(pos.z < -150 || pos.z > 150){
+            if(pos.z > 150){
                 pos.z=0;
                 velocity.y = 0;
@@ -94,4 +99,5 @@
                 }
             
+            
             // Camera
             Camera* camera = this->getCamera();
@@ -102,4 +108,5 @@
             }
 
+            
             setPosition(pos);
             setOrientation(Vector3::UNIT_Y, Degree(270));
