[Orxonox-commit 7742] r12335 - code/branches/OrxoBlox_FS19/src/modules/OrxoBlox

ahuwyler at orxonox.net ahuwyler at orxonox.net
Thu May 2 16:17:14 CEST 2019


Author: ahuwyler
Date: 2019-05-02 16:17:14 +0200 (Thu, 02 May 2019)
New Revision: 12335

Modified:
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
Log:
Random Walls are created

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-02 14:06:01 UTC (rev 12334)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-02 14:17:14 UTC (rev 12335)
@@ -223,8 +223,6 @@
     }
 
     void OrxoBlox::createWall(void){
-        orxout() <<"Hello idiot1"<< endl;
-
         this->futureWall_ = new OrxoBloxWall(this->center_->getContext());
         // Apply the stone template to the stone.
         this->futureWall_->addTemplate(this->center_->getWallTemplate());
@@ -233,7 +231,7 @@
         this->center_->attach(this->futureWall_);
         
         
-        this->futureWall_->setPosition(10, 10, 0.0f);
+        this->futureWall_->setPosition(0, 0, 0.0f);
         this->futureWall_->setGame(this);
     }
 

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc	2019-05-02 14:06:01 UTC (rev 12334)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc	2019-05-02 14:17:14 UTC (rev 12335)
@@ -18,8 +18,8 @@
     {
         RegisterObject(OrxoBloxWall);
 
-        this->num_Stones_ = 2;//1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
-        this->size_ = 10.0f;
+        this->num_Stones_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
+        this->size_ = 9.0f;
         this->delay_ = false;
         this->orxoblox_ = this->getOrxoBlox();
         this->createWall();
@@ -27,26 +27,28 @@
 
 
     void OrxoBloxWall::createWall(void){
-        orxout() <<"Hello idiot"<< endl;
         for (unsigned int i=0; i<this->num_Stones_;++i){
-            orxout() <<i<< endl;
-            OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
-            this->TotalStones_.push_back(stone);
-            this->attach(stone);
-            stone->setPosition(size_*i, 0, 0.0f);
+            unsigned int j=1 + static_cast<unsigned int>(rnd(2.0f)); //<! random number between 0 and 2;
+            if(j<2){
+                this->size_ = 9.0f;
+                OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
+                this->TotalStones_.push_back(stone);
+                this->attach(stone);
+                stone->setPosition(size_*i -55.5f, 0, 0.0f);
 
 
 
-            if(this->orxoblox_ != nullptr)
-            {
-                stone->setGame(this->orxoblox_);
-                if(this->orxoblox_->getCenterpoint() != nullptr)
-                    stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate());
+                if(this->orxoblox_ != nullptr)
+                {
+                    stone->setGame(this->orxoblox_);
+                    if(this->orxoblox_->getCenterpoint() != nullptr)
+                        stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate());
+                    else
+                        orxout()<< "tetris_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl;
+                }
                 else
-                    orxout()<< "tetris_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl;
+                    orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl;
             }
-            else
-                orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl;
 
         }
 



More information about the Orxonox-commit mailing list