[Orxonox-commit 7738] r12331 - code/branches/OrxoBlox_FS19/src/modules/OrxoBlox

ahuwyler at orxonox.net ahuwyler at orxonox.net
Thu May 2 15:30:57 CEST 2019


Author: ahuwyler
Date: 2019-05-02 15:30:57 +0200 (Thu, 02 May 2019)
New Revision: 12331

Modified:
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.h
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h
Log:
Walls are bigger

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-02 13:30:57 UTC (rev 12331)
@@ -48,7 +48,7 @@
 
 #include "OrxoBloxCenterpoint.h"
 #include "OrxoBloxBall.h"
-#include "OrxoBloxBot.h"//Remove??
+//#include "OrxoBloxBot.h"//Remove??
 #include "OrxoBloxStones.h"
 #include "OrxoBloxWall.h"
 #include "OrxoBloxShip.h"
@@ -71,7 +71,7 @@
         this->ball_ = nullptr;
         this->futureWall_ = nullptr;
         this->player_ = nullptr;
-        
+        level_ = 0;
 
         this->setHUDTemplate("OrxoBloxHUD");
         //Error when specified
@@ -148,6 +148,7 @@
             this->ball_->setAccelerationFactor(this->center_->getBallAccelerationFactor());
             this->ball_->setBatLength(this->center_->getBatLength());
 
+            level_=1;
 
             // Create the first Wall.
             this->createWall();
@@ -212,8 +213,15 @@
 
     //void startWall(void);
     
+    void OrxoBlox::LevelUp(){
+        level_++;
+        //When levelup? wo wird es ausgeloest?
+        //new location of ship
+        //new amount of balls
+        //create balls
+        //insert new wall
+    }
 
-
     void OrxoBlox::createWall(void){
         this->futureWall_ = new OrxoBloxWall(this->center_->getContext());
         // Apply the stone template to the stone.

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-05-02 13:30:57 UTC (rev 12331)
@@ -75,6 +75,8 @@
 
             OrxoBloxShip* getPlayer();
 
+            void LevelUp();
+
             /**
             @brief Set the OrxoBloxCenterpoint (the playing field).
             @param center A pointer to the OrxoBloxCenterpoint to be set.
@@ -96,6 +98,7 @@
             WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
             
             PlayerInfo* player_;
+            unsigned int level_;
 
             Timer starttimer_; //!< A timer to delay the start of the game.
             

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc	2019-05-02 13:30:57 UTC (rev 12331)
@@ -143,7 +143,7 @@
             velocity.z = -velocity.z;
             // And its position is set as to not overstep the boundary it has just crossed.
             if (position.z > this->fieldHeight_ / 2)
-                position.z = this->fieldHeight_ / 2;
+                ChatManager::message("Ball hat das Feld verlassen.Jerome");
             if (position.z < -this->fieldHeight_ / 2)
                 position.z = -this->fieldHeight_ / 2;
 

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h	2019-05-02 13:30:57 UTC (rev 12331)
@@ -122,8 +122,8 @@
                 { return this->batlength_; }
 
             
-            void applyBats(); //!< Get the bats over the network.
 
+
             static const float MAX_REL_Z_VELOCITY;
 
             void setDefScoreSound(const std::string& engineSound);

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h	2019-05-02 13:30:57 UTC (rev 12331)
@@ -69,10 +69,9 @@
 {
     class OrxoBlox;
     class OrxoBloxBall;
-    
     class OrxoBloxCenterpoint;
     class OrxoBloxWall;
-    class OrxobloxStones;
+    class OrxoBloxStones;
     class OrxoBloxShip;
 }
 

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.cc	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.cc	2019-05-02 13:30:57 UTC (rev 12331)
@@ -17,7 +17,7 @@
         RegisterObject(OrxoBloxStones);
 
         this->size_ = 10.0f;
-        this->health_ = 10;
+        this->health_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
         this->delay_ = false;
     }
 }
\ No newline at end of file

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.h	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.h	2019-05-02 13:30:57 UTC (rev 12331)
@@ -2,6 +2,9 @@
 #define _OrxoBloxStones_H__
 
 
+#include "OrxoBlox/OrxoBloxPrereqs.h"
+
+
 #include "worldentities/StaticEntity.h"
 #include "tools/Timer.h"
 
@@ -24,6 +27,18 @@
             //}
 
             /**
+            @brief Set the size of the stone.
+            @param size The dimensions a stone has in the game world. (A stone is a cube)
+            */
+            void setSize(float size)
+                { this->size_ = size; }
+            /**
+            @brief Get the size of the stone.
+            @return Returns the dimensions a stone has in the game world. (A stone is a cube)
+            */
+            float getSize(void) const
+                { return this->size_; }
+            /**
             @brief Set the Health of the stone.
             @param size The dimensions a stone has in the game world. (A stone is a cube)
             */

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc	2019-05-02 13:30:57 UTC (rev 12331)
@@ -3,6 +3,9 @@
 #include "core/XMLPort.h"
 
 #include "OrxoBlox.h"
+#include "OrxoBloxStones.h"
+#include "OrxoBloxCenterpoint.h"
+#include "util/Math.h"
 
 namespace orxonox
 {
@@ -15,13 +18,27 @@
     {
         RegisterObject(OrxoBloxWall);
 
-        this->health_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
+        this->num_Stones_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
         this->delay_ = false;
         this->orxoblox_ = this->getOrxoBlox();
+        this->createWall();
+    }
 
 
-        OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
-        if(this->orxoblox_ != nullptr)
+    void OrxoBloxWall::createWall(void){
+
+        for (unsigned int i=0; i<this->num_Stones_;++i){
+            OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
+
+
+            this->TotalStones_.push_back(stone);
+            this->attach(stone);
+            
+            stone->setPosition(0.0f, i, 0.0f);
+
+
+
+            if(this->orxoblox_ != nullptr)
             {
                 stone->setGame(this->orxoblox_);
                 if(this->orxoblox_->getCenterpoint() != nullptr)
@@ -31,8 +48,30 @@
             }
             else
                 orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl;
+
+        }
+
+
+
+        // OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
+        // if(this->orxoblox_ != nullptr)
+        //     {
+        //         stone->setGame(this->orxoblox_);
+        //         if(this->orxoblox_->getCenterpoint() != nullptr)
+        //             stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate());
+        //         else
+        //             orxout()<< "orxoblox_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl;
+        //     }
+        //     else
+        //         orxout()<< "orxoblox_ == nullptr in TetrisBrick.cc"<< endl;
     }
 
+    OrxoBloxStones* OrxoBloxWall::getStone(unsigned int i)
+    {
+        if(i < this->TotalStones_.size())
+            return this->TotalStones_[i];
+        else return nullptr;
+    }
 
     OrxoBlox* OrxoBloxWall::getOrxoBlox()
     {

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h	2019-05-02 11:47:32 UTC (rev 12330)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h	2019-05-02 13:30:57 UTC (rev 12331)
@@ -1,7 +1,7 @@
 #ifndef _OrxoBloxWall_H__
 #define _OrxoBloxWall_H__
 
-
+#include "OrxoBlox/OrxoBloxPrereqs.h"
 #include "worldentities/StaticEntity.h"
 #include "tools/Timer.h"
 
@@ -22,7 +22,7 @@
             virtual ~OrxoBloxWall() {}
              //   this.destroy();
             //}
-
+            OrxoBloxStones* getStone(unsigned int i);
             /**
             @brief Set the Health of the stone.
             @param size The dimensions a stone has in the game world. (A stone is a cube)
@@ -29,26 +29,24 @@
             */
             void setHealth(unsigned int health)
                 { 
-                    this->health_ = health; 
+                    this->totalhealth_ = health; 
                 }
+
             /**
             @brief Get the size of the stone.
             @return Returns the dimensions a stone has in the game world. (A stone is a cube)
             */
             unsigned int getHealth(void) const
-                { return this->health_; }
+                { return this->totalhealth_; }
 
-            void gotHit(){
-                if (this->health_ > 0){
-                    this->health_ -= this->health_; 
-                    }
-                //  else ~OrxoBloxStones();
-                }
             void setGame(OrxoBlox* orxoblox)
                 { assert(orxoblox); orxoblox_ = orxoblox; }
         private:
+            void createWall(void);
             OrxoBlox* getOrxoBlox();
-            unsigned int health_;
+            unsigned int totalhealth_;
+            unsigned int num_Stones_;
+            std::vector<OrxoBloxStones*> TotalStones_; //!< A list of all stones in a Wall.
             bool delay_;
             OrxoBlox* orxoblox_;
             



More information about the Orxonox-commit mailing list