Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12331


Ignore:
Timestamp:
May 2, 2019, 3:30:57 PM (5 years ago)
Author:
ahuwyler
Message:

Walls are bigger

Location:
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc

    r12329 r12331  
    4949#include "OrxoBloxCenterpoint.h"
    5050#include "OrxoBloxBall.h"
    51 #include "OrxoBloxBot.h"//Remove??
     51//#include "OrxoBloxBot.h"//Remove??
    5252#include "OrxoBloxStones.h"
    5353#include "OrxoBloxWall.h"
     
    7272        this->futureWall_ = nullptr;
    7373        this->player_ = nullptr;
    74        
     74        level_ = 0;
    7575
    7676        this->setHUDTemplate("OrxoBloxHUD");
     
    149149            this->ball_->setBatLength(this->center_->getBatLength());
    150150
     151            level_=1;
    151152
    152153            // Create the first Wall.
     
    213214    //void startWall(void);
    214215   
    215 
     216    void OrxoBlox::LevelUp(){
     217        level_++;
     218        //When levelup? wo wird es ausgeloest?
     219        //new location of ship
     220        //new amount of balls
     221        //create balls
     222        //insert new wall
     223    }
    216224
    217225    void OrxoBlox::createWall(void){
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h

    r12314 r12331  
    7676            OrxoBloxShip* getPlayer();
    7777
     78            void LevelUp();
     79
    7880            /**
    7981            @brief Set the OrxoBloxCenterpoint (the playing field).
     
    9799           
    98100            PlayerInfo* player_;
     101            unsigned int level_;
    99102
    100103            Timer starttimer_; //!< A timer to delay the start of the game.
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc

    r12310 r12331  
    144144            // And its position is set as to not overstep the boundary it has just crossed.
    145145            if (position.z > this->fieldHeight_ / 2)
    146                 position.z = this->fieldHeight_ / 2;
     146                ChatManager::message("Ball hat das Feld verlassen.Jerome");
    147147            if (position.z < -this->fieldHeight_ / 2)
    148148                position.z = -this->fieldHeight_ / 2;
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h

    r12310 r12331  
    123123
    124124           
    125             void applyBats(); //!< Get the bats over the network.
     125
    126126
    127127            static const float MAX_REL_Z_VELOCITY;
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h

    r12314 r12331  
    7070    class OrxoBlox;
    7171    class OrxoBloxBall;
    72    
    7372    class OrxoBloxCenterpoint;
    7473    class OrxoBloxWall;
    75     class OrxobloxStones;
     74    class OrxoBloxStones;
    7675    class OrxoBloxShip;
    7776}
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.cc

    r12307 r12331  
    1818
    1919        this->size_ = 10.0f;
    20         this->health_ = 10;
     20        this->health_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
    2121        this->delay_ = false;
    2222    }
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.h

    r12307 r12331  
    11#ifndef _OrxoBloxStones_H__
    22#define _OrxoBloxStones_H__
     3
     4
     5#include "OrxoBlox/OrxoBloxPrereqs.h"
    36
    47
     
    2427            //}
    2528
     29            /**
     30            @brief Set the size of the stone.
     31            @param size The dimensions a stone has in the game world. (A stone is a cube)
     32            */
     33            void setSize(float size)
     34                { this->size_ = size; }
     35            /**
     36            @brief Get the size of the stone.
     37            @return Returns the dimensions a stone has in the game world. (A stone is a cube)
     38            */
     39            float getSize(void) const
     40                { return this->size_; }
    2641            /**
    2742            @brief Set the Health of the stone.
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc

    r12308 r12331  
    44
    55#include "OrxoBlox.h"
     6#include "OrxoBloxStones.h"
     7#include "OrxoBloxCenterpoint.h"
     8#include "util/Math.h"
    69
    710namespace orxonox
     
    1619        RegisterObject(OrxoBloxWall);
    1720
    18         this->health_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
     21        this->num_Stones_ = 1 + static_cast<unsigned int>(rnd(6.0f)); //<! random number between 0 and 7;
    1922        this->delay_ = false;
    2023        this->orxoblox_ = this->getOrxoBlox();
     24        this->createWall();
     25    }
    2126
    2227
    23         OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
    24         if(this->orxoblox_ != nullptr)
     28    void OrxoBloxWall::createWall(void){
     29
     30        for (unsigned int i=0; i<this->num_Stones_;++i){
     31            OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
     32
     33
     34            this->TotalStones_.push_back(stone);
     35            this->attach(stone);
     36           
     37            stone->setPosition(0.0f, i, 0.0f);
     38
     39
     40
     41            if(this->orxoblox_ != nullptr)
    2542            {
    2643                stone->setGame(this->orxoblox_);
     
    3249            else
    3350                orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl;
     51
     52        }
     53
     54
     55
     56        // OrxoBloxStones* stone = new OrxoBloxStones(this->getContext());
     57        // if(this->orxoblox_ != nullptr)
     58        //     {
     59        //         stone->setGame(this->orxoblox_);
     60        //         if(this->orxoblox_->getCenterpoint() != nullptr)
     61        //             stone->addTemplate(this->orxoblox_->getCenterpoint()->getStoneTemplate());
     62        //         else
     63        //             orxout()<< "orxoblox_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl;
     64        //     }
     65        //     else
     66        //         orxout()<< "orxoblox_ == nullptr in TetrisBrick.cc"<< endl;
    3467    }
    3568
     69    OrxoBloxStones* OrxoBloxWall::getStone(unsigned int i)
     70    {
     71        if(i < this->TotalStones_.size())
     72            return this->TotalStones_[i];
     73        else return nullptr;
     74    }
    3675
    3776    OrxoBlox* OrxoBloxWall::getOrxoBlox()
  • code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h

    r12307 r12331  
    22#define _OrxoBloxWall_H__
    33
    4 
     4#include "OrxoBlox/OrxoBloxPrereqs.h"
    55#include "worldentities/StaticEntity.h"
    66#include "tools/Timer.h"
     
    2323             //   this.destroy();
    2424            //}
    25 
     25            OrxoBloxStones* getStone(unsigned int i);
    2626            /**
    2727            @brief Set the Health of the stone.
     
    3030            void setHealth(unsigned int health)
    3131                {
    32                     this->health_ = health;
     32                    this->totalhealth_ = health;
    3333                }
     34
    3435            /**
    3536            @brief Get the size of the stone.
     
    3738            */
    3839            unsigned int getHealth(void) const
    39                 { return this->health_; }
     40                { return this->totalhealth_; }
    4041
    41             void gotHit(){
    42                 if (this->health_ > 0){
    43                     this->health_ -= this->health_;
    44                     }
    45                 //  else ~OrxoBloxStones();
    46                 }
    4742            void setGame(OrxoBlox* orxoblox)
    4843                { assert(orxoblox); orxoblox_ = orxoblox; }
    4944        private:
     45            void createWall(void);
    5046            OrxoBlox* getOrxoBlox();
    51             unsigned int health_;
     47            unsigned int totalhealth_;
     48            unsigned int num_Stones_;
     49            std::vector<OrxoBloxStones*> TotalStones_; //!< A list of all stones in a Wall.
    5250            bool delay_;
    5351            OrxoBlox* orxoblox_;
Note: See TracChangeset for help on using the changeset viewer.