[Orxonox-commit 5138] r9803 - code/trunk/src/modules/tetris

jo at orxonox.net jo at orxonox.net
Thu Nov 21 23:20:32 CET 2013


Author: jo
Date: 2013-11-21 23:20:31 +0100 (Thu, 21 Nov 2013)
New Revision: 9803

Modified:
   code/trunk/src/modules/tetris/Tetris.cc
   code/trunk/src/modules/tetris/TetrisBrick.cc
Log:
The brick falldown acceleration is increased, but the velocity is limited, such that occasional break-throughs are prevented.

Modified: code/trunk/src/modules/tetris/Tetris.cc
===================================================================
--- code/trunk/src/modules/tetris/Tetris.cc	2013-11-21 21:11:27 UTC (rev 9802)
+++ code/trunk/src/modules/tetris/Tetris.cc	2013-11-21 22:20:31 UTC (rev 9803)
@@ -123,7 +123,7 @@
                 this->findFullRows();
                 this->startBrick();
             }
-        }
+        } 
     }
 
     bool Tetris::isValidMove(TetrisStone* stone, const Vector3& position)

Modified: code/trunk/src/modules/tetris/TetrisBrick.cc
===================================================================
--- code/trunk/src/modules/tetris/TetrisBrick.cc	2013-11-21 21:11:27 UTC (rev 9802)
+++ code/trunk/src/modules/tetris/TetrisBrick.cc	2013-11-21 22:20:31 UTC (rev 9803)
@@ -106,29 +106,24 @@
         if(i == 0) //setting the first stone as
         {
             stone->setPosition(0.0f, 0.0f, 0.0f);
-            stone->setName("Base");
         }
         else if(i == 1)
         {
             stone->setPosition(0.0f, size_, 0.0f);
-            stone->setName("Y");
         }
         else if(i == 2)
         {
             if(this->shapeIndex_ == 1 || this->shapeIndex_ == 6 || this->shapeIndex_ == 7)
             {
             	stone->setPosition(0.0f, 2*size_, 0.0f);
-            	stone->setName("2Y");
             }
             else if(this->shapeIndex_ == 3 || this->shapeIndex_ == 4|| this->shapeIndex_ == 5)
             {
             	stone->setPosition(size_, 0, 0.0f);
-            	stone->setName("X");
             }
             else if(this->shapeIndex_ == 2)
             {
             	stone->setPosition(-size_, 0, 0.0f);
-            	stone->setName("-X");
             }
         }
         else if(i == 3)
@@ -136,27 +131,22 @@
             if(this->shapeIndex_ == 2 || this->shapeIndex_ == 5)
             {
             	stone->setPosition(size_, size_, 0.0f);
-            	stone->setName("XY");
             }
             else if(this->shapeIndex_ == 1)
             {
             	stone->setPosition(0, 3*size_, 0.0f);
-            	stone->setName("3Y");
             }
             else if(this->shapeIndex_ == 3 || this->shapeIndex_ == 7)
             {
             	stone->setPosition(-size_, 0, 0.0f);
-            	stone->setName("-X");
             }
             else if(this->shapeIndex_ == 4)
             {
             	stone->setPosition(-size_, size_, 0.0f);
-            	stone->setName("-XY");
             }
             else if(this->shapeIndex_ == 6)
             {
             	stone->setPosition(size_, 0, 0.0f);
-            	stone->setName("X");
             }
         }
     }
@@ -194,7 +184,10 @@
     {
         if(value.x < 0) //speedup on key down
         {
-            this->setVelocity(this->getVelocity()*1.1);
+            Vector3 v_new = this->getVelocity()*1.2;
+            if (v_new.y < -400.0f) //limiting the speed to prevent break throughs.
+                v_new.y = -400.0f;
+            this->setVelocity(v_new);
         }
         else if(!this->lockRotation_) //rotate when key up is pressed
         {




More information about the Orxonox-commit mailing list