Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11766


Ignore:
Timestamp:
Feb 18, 2018, 4:02:50 PM (6 years ago)
Author:
landauf
Message:

merged SOBv2_HS17

Location:
code/branches/Presentation_HS17_merge
Files:
16 edited
7 copied

Legend:

Unmodified
Added
Removed
  • code/branches/Presentation_HS17_merge

  • code/branches/Presentation_HS17_merge/data/levels/SOB.oxw

    r11449 r11766  
    1313        include("overlays/SOBHUD.oxo")
    1414        ?>
     15
    1516
    1617
     
    4849
    4950
    50 
    5151        <Template name=sobFigureTemplate>
    5252                <SOBFigure camerapositiontemplate=sobfigurecameras collisionType="dynamic" position="0,0,30">
     
    5757
    5858                        <collisionShapes>
    59                                 <BoxCollisionShape position="-2,0,2" halfExtents="3,1,10" />
     59                                <BoxCollisionShape position="0,0,2" halfExtents="3,1,10" />
    6060                        </collisionShapes>
    6161
    6262
    6363                </SOBFigure>
     64        </Template>
     65
     66
     67        <Template name=fireball>
     68                <SOBFireball collisionType="dynamic" speed=90>
     69                        <attached>
     70                                <Model mesh="planets/sol.mesh" position="0,0,0" scale=3 pitch=90/>
     71
     72                                <ParticleSpawner source="Orxonox/fire4" startdelay=0  position="-4,0,0" visible="false"/>
     73                               
     74                        </attached>
     75                        <collisionShapes>
     76                                <SphereCollisionShape position="0,0,0" radius="3" />                   
     77                        </collisionShapes>
     78                </SOBFireball>
    6479        </Template>
     80
     81        <Template name=gumbaShootable>
     82                <SOBGumbaBoss collisionType="dynamic" speed=60>
     83                        <attached>
     84                                <Model mesh="Goomba.mesh" position="0,0,1" scale=3 pitch=90/>                           
     85                        </attached>
     86                        <collisionShapes>
     87                                <BoxCollisionShape position="0,0,0" halfExtents="5,5,3" />                     
     88                        </collisionShapes>
     89                </SOBGumbaBoss>
     90        </Template>
     91
    6592
    6693        <Level
     
    95122
    96123
    97                                         <!--Gumba-->
     124
     125
     126
     127
    98128
    99129                                        <SOBGumba collisionType="dynamic" speed=40 position = "240,0,0">
     
    106136                                                </collisionShapes>
    107137                                        </SOBGumba>
     138
    108139                                        <SOBGumba collisionType="dynamic" speed=30 position = "420,0,0">
    109140                                                <attached>
     
    193224                                        </SOBGumba>
    194225
    195                                         <SOBGumba collisionType="dynamic" speed=30 position = "1750,0,0">
    196                                                 <attached>
    197                                                         <Model mesh="Goomba.mesh" position="0,0,21" scale=3 pitch=90/>
    198                                                        
    199                                                 </attached>
    200                                                 <collisionShapes>
    201                                                         <BoxCollisionShape position="0,0,20" halfExtents="5,5,3" />                     
    202                                                 </collisionShapes>
    203                                         </SOBGumba>
    204 
    205                                         <SOBGumba collisionType="dynamic" speed=20 position = "1770,0,0">
    206                                                 <attached>
    207                                                         <Model mesh="Goomba.mesh" position="0,0,21" scale=3 pitch=90/>
    208                                                        
    209                                                 </attached>
    210                                                 <collisionShapes>
    211                                                         <BoxCollisionShape position="0,0,20" halfExtents="5,5,3" />                     
    212                                                 </collisionShapes>
    213                                         </SOBGumba>
    214 
     226                                        <!--GumbaBoss-->
     227                                        <SOBGumbaBoss collisionType="dynamic" speed=20 position = "1750,0,0">
     228                                                <attached>
     229                                                        <Model mesh="Goomba.mesh" position="0,0,21" scale=6 pitch=90/>
     230                                                       
     231                                                </attached>
     232                                                <collisionShapes>
     233                                                        <BoxCollisionShape position="0,0,20" halfExtents="10,10,6" />                   
     234                                                </collisionShapes>
     235                                        </SOBGumbaBoss>
     236x       
    215237
    216238                                        <!--CollisionShape for Gumba-->
     
    225247                                                </collisionShapes>
    226248                                        </StaticEntity>
    227 
    228 
    229 
    230                                        
    231 
    232249
    233250
     
    581598
    582599
    583                                         <!-- Luft4 -->
     600                                        <!-- Luft4 (BossAbschnitt)-->
    584601                                        <Model mesh="Dreieck.mesh" position="1560,0,-10" scale=10 Roll=90 Pitch=-90 yaw=90/>                    <!-- L4.1 -->
    585602
    586603                                        <Model mesh="Rohr.mesh" position="1645,5,-35" scale=10  roll=90 yaw=90 pitch=-90 />                     <!-- L4.2 -->
    587 
    588                                         <Model mesh="Cube1.1.mesh" position="1690,0,20" scale=10/>                                                                              <!-- L4.3 -->
    589                                         <Model mesh="Cube1.1.mesh" position="1700,0,20" scale=10/>                                                                              <!-- L4.4 -->
    590 
    591                                         <SOBQBlock collisionType="static" type="Coin" position="1710,0,20" mass='-1'>                                   <!-- L4.5 -->                           
    592                                                 <attached>
    593                                                         <Model mesh="QCube.mesh" scale=10 pitch=90/>
    594                                                         <Model mesh="QCube-grey.mesh" scale=10 pitch=90 visible=false/>                         
    595                                                 </attached>
    596                                                 <collisionShapes>
    597                                                         <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
    598                                                 </collisionShapes>
    599                                         </SOBQBlock>
    600 
    601                                         <Model mesh="Cube1.1.mesh" position="1720,0,20" scale=10/>                                                                              <!-- L4.6 -->
    602604                                        <Model mesh="Rohr.mesh" position="1805,5,-35" scale=10  roll=90 yaw=90 pitch=-90 />                     <!-- L4.7 -->
    603605                                        <Model mesh="Dreieckgross.mesh" position="1850,0,-10" scale=10 pitch=90 />                                              <!-- L4.8 -->
     
    606608
    607609
    608                                         <Model mesh="Schloss.mesh" position="2050,40,60" scale=12 pitch=90/>                                    <!-- L4.12 -->
     610                                        <Model mesh="Schloss.mesh" position="2050,40,80" scale=15 pitch=90/>                                    <!-- L4.12 -->
    609611                                        <Model mesh="Fahne.mesh" position="1984,-5,88" scale=10 pitch=90/>                                              <!-- L4.11 -->
    610612                                        <Model mesh="Fahnenstange.mesh" position="1990,0,95" pitch=90 scale=3/>                                 <!-- L4.10 -->
     
    680682                                        </StaticEntity>
    681683
    682 
    683 
    684 
    685                                         <StaticEntity collisionType="static" mass='-1'>
    686                                                 <collisionShapes>
    687 
    688                                                         <BoxCollisionShape position="1690,0,20" halfExtents="5,5,5" />                                  <!-- 4.3 -->
    689                                                         <BoxCollisionShape position="1700,0,20" halfExtents="5,5,5" />                                  <!-- 4.4 -->
    690                                                         <BoxCollisionShape position="1720,0,20" halfExtents="5,5,5" />                                  <!-- 4.6 -->
    691 
    692 
    693                                                 </collisionShapes>
    694                                         </StaticEntity>
    695684
    696685
  • code/branches/Presentation_HS17_merge/src/libraries/tools/Mesh.cc

    r11080 r11766  
    7979    }
    8080
     81   
     82
    8183    void Mesh::setCastShadows(bool bCastShadows)
    8284    {
     
    98100        if (this->entity_)
    99101            this->entity_->setMaterialName(name);
     102    }
     103
     104    // PRE: a valid  Ogre::Entity* entity with a valid subentity at index
     105    // POST: changed material of subentity at index to name
     106    void Mesh::setSubMaterial(const std::string& name, const int index){
     107         if (this->entity_ && this->entity_->getSubEntity(index))
     108        {
     109                this->entity_->getSubEntity(index)->setMaterialName(name);
     110        }
     111        else
     112            orxout() << "ERROR at Index " << index << endl;
    100113    }
    101114
  • code/branches/Presentation_HS17_merge/src/libraries/tools/Mesh.h

    r11080 r11766  
    5050            void setMaterial(const std::string& name);
    5151            const std::string& getMaterial() const;
    52 
     52            void setSubMaterial(const std::string& name, const int index);
    5353            void setVisible(bool bVisible);
    5454            bool isVisible() const;
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/CMakeLists.txt

    r11416 r11766  
    99  SOBHUDInfo.cc
    1010  SOBGumba.cc
     11  SOBFireball.cc
    1112  SOBFlagstone.cc
    1213  SOBCastlestone.cc
    1314  SOBCoin.cc
     15  SOBGumbaBoss.cc
    1416
    1517)
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.cc

    r11418 r11766  
    4444#include "SOBFigure.h"
    4545#include "graphics/Camera.h"
     46#include "Highscore.h"
    4647
    4748
     
    4950namespace orxonox
    5051{
    51 
     52    bool newHighscore=0;
    5253    RegisterUnloadableClass(SOB);
    5354
     
    124125        GSLevel::startMainMenu();
    125126        Deathmatch::end();
    126     }
     127}
    127128
    128129    void SOB::restart() {
     
    167168        if (this->figure_ != nullptr && figure_->lvlEnded_) {
    168169            std::stringstream a;
    169             a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
     170            if(!newHighscore){
     171                a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
     172            }
     173            else{
     174                a << "Congrats, new Highscore! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
     175            }
    170176            info_ =a.str();
    171177
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.h

    r11418 r11766  
    7676                points_+=100;
    7777            }
     78            void addGumbaBoss() {
     79                points_+=5000;
     80            }
    7881            void addPoints(int poi) {
    7982                points_+=poi;
     
    103106
    104107            WeakPtr<SOBCenterpoint> center_;
     108            bool newHighscore;
    105109
    106110        protected:
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.cc

    r11420 r11766  
    2323 *      Julien Kindle
    2424 *   Co-authors:
     25 *      Noah Zarro
     26 *      Theo von Arx
    2527 *     
    2628 *
     
    3941#include "graphics/Camera.h"
    4042#include "graphics/ParticleSpawner.h"
     43#include <OgreMath.h>
    4144
    4245#include "SOBMushroom.h"
    4346#include "SOBGumba.h"
     47#include "SOBGumbaBoss.h"
     48#include "SOBFireball.h"
    4449#include "SOB.h"
    4550#include "SOBFlagstone.h"
    4651#include "SOBCastlestone.h"
     52#include "SOBFireball.h"
     53#include "Highscore.h"
    4754#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
    4855
     
    5966
    6067        //Vars for movement of player
    61         moveUpPressed_ = false;
    62         moveDownPressed_ = false;
    63         moveLeftPressed_ = false;
    64         moveDownPressed_ = false;
    65         firePressed_ = false;
    66         collDisZ_ = 0;
     68        moveUpPressed_      = false;
     69        moveDownPressed_    = false;
     70        moveLeftPressed_    = false;
     71        moveDownPressed_    = false;
     72        firePressed_        = false;
     73        collDisZ_           = 0;
     74
    6775        //Times and turning
    68         timeSinceLastFire_ = 0.0;
    69         lastSpeed_z = 0.0;
    70         pitch_ = 0.0;
    71         timeCounter_ = 0;
     76        timeSinceLastFire_  = 0.0;
     77        lastSpeed_z         = 0.0;
     78        pitch_              = 0.0;
     79        timeCounter_        = 0;
    7280
    7381        //Properties of player
    74         gotPowerUp_ = false;
    75         isColliding_ = true;
    76         particlespawner_ = NULL;
     82
     83        isColliding_        = true;
     84        particlespawner_    = NULL;
    7785
    7886        //Properties of players life
    79         predead_ = false;
    80         dead_ = false;
    81         lvlEnded_ = false;
     87        predead_            = false;
     88        dead_               = false;
     89        lvlEnded_           = false;
    8290        reachedLvlEndState_ = 0;
     91
     92        // Properties concerning PowerUps and items
     93        PowerUpCounter_     = 0;
     94        maxPowerUp_         = 2;
     95        FireballPower       = 2;
     96        //Properties of fireing Fireballs, NOTE! fireballs are fired with the moveUP Key, not with the fire key
     97        fireallowed_        = true;
     98        firecooldown_       = 0;
    8399
    84100       
     
    97113
    98114        //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr
    99         SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject);
    100         SOBGumba* gumba = orxonox_cast<SOBGumba*>(otherObject);
    101         SOBFlagstone* flagstone = orxonox_cast<SOBFlagstone*>(otherObject);
    102         SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*>(otherObject);
    103 
    104         //Check if otherObject is a powerup
     115        SOBMushroom*    mush        = orxonox_cast<SOBMushroom*>    (otherObject);
     116        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>       (otherObject);
     117        SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>   (otherObject);
     118        SOBFlagstone*   flagstone   = orxonox_cast<SOBFlagstone*>   (otherObject);
     119        SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*> (otherObject);
     120        SOBFireball*    fireball    = orxonox_cast<SOBFireball*>    (otherObject);
     121        SOB* SOBGame                = orxonox_cast<SOB*>            (getGametype());
     122
     123
     124        //Check if otherObject is a powerup-mushroom
    105125        if (mush != nullptr && !(mush->hasCollided_)) {
    106126            otherObject->destroyLater();
    107             gotPowerUp_ = true;
    108             SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); //Get the Gametype
     127
     128            PowerUpCounter_++;
     129            if(PowerUpCounter_ > maxPowerUp_)   PowerUpCounter_ = maxPowerUp_; // you had already the max
     130            else                                this->changeClothes();
     131
    109132            SOBGame->addMushroom(); // Tell the gametype to increase points
    110133            mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once
     134           
     135           
     136        }
     137
     138       
    111139
    112140        //Check if otherObject is a Gumba (that walking enemies)
    113         } else if (gumba != nullptr && !(gumba->hasCollided_)) {
    114 
    115             //If player jumps on its head, kill it, else, kill the player
     141
     142         else if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
     143
     144            //If player jumps on its head, kill the Gumba, else, kill the player
    116145            if (getVelocity().z >= -20) {
    117               Vector3 vel = getVelocity();
    118               vel.y = -80;
    119               vel.z = 200;
    120               setVelocity(vel);
    121               predead_=true;
    122               SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    123               SOBGame->setDone(true);
     146                // If player hasn't a power up, he dies. Else he shrinks and the gumba dies.
     147                if(PowerUpCounter_ == 0){
     148                    this->die();
     149                }
     150                else{
     151                    PowerUpCounter_--;
     152                    this->changeClothes();
     153
     154                    gumba->destroyLater();
     155                    gumba->hasCollided_ = true;
     156                }
    124157
    125158          } else {
    126159            gumba->destroyLater();
    127160            gumba->hasCollided_ = true;
    128             SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    129161            SOBGame->addGumba();
    130162
    131163
    132         }
    133     }
     164            }
     165        }
     166        else if (gumbaBoss != nullptr && !(gumbaBoss->hasCollided_)) {
     167            if (getVelocity().z >= -20) {
     168                // If player hasn't a power up, he dies. Else he dies directly.
     169                this->die();
     170            }
     171
     172            else {
     173                gumbaBoss->destroyLater();
     174                gumbaBoss->hasCollided_ = true;
     175                SOBGame->addGumbaBoss();
     176                }
     177        }
     178        else if (fireball != nullptr && !(fireball->hasCollided_)){
     179            if(PowerUpCounter_ == 0){
     180                    this->die();
     181                }
     182            PowerUpCounter_--;
     183            this->changeClothes();
     184            fireball->destroyLater();
     185        }
    134186
    135187    //Purpose is that if player hits the flag, he should walk into the castle at the end of the level. For that we use SOBCastlestone
     
    137189        flagstone->hasCollided_ = true;
    138190        reachedLvlEndState_ = 1;
    139         SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     191
    140192        SOBGame->setDone(true);
    141193        SOBGame->addPoints(flagstone->getPoints());
     
    159211}
    160212
     213//Function to spawn the Fireball
     214void SOBFigure::spawnFireball() {
     215        SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
     216
     217         SOBFireball* ball = new SOBFireball(center_->getContext());
     218         Vector3 spawnpos = this->getWorldPosition();
     219         spawnpos.z += 0;
     220
     221        if (ball != nullptr && center_ != nullptr)
     222        {
     223            ball->addTemplate("fireball");
     224            bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
     225            ball->setDirection(direction);
     226            if(direction)
     227            {
     228                spawnpos.x+=10;
     229            }
     230            else
     231            {
     232                spawnpos.x-=10;
     233            }
     234            ball->setPosition(spawnpos);
     235
     236        }
     237     }
     238
    161239//For those of you who don't have an idea: the tick function is called about 50 times/sec
    162240void SOBFigure::tick(float dt)
     
    166244
    167245    bool inputAllowed = true;
     246    //SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    168247
    169248    //the particle spawner that generates the fire from the backpack when pressed
     
    174253            particlespawner_ = object;
    175254        }
    176     }
     255
     256    }
     257   
    177258
    178259
     
    190271    //if input blocked, then cancel every movement operation
    191272    if (!inputAllowed) {
    192         moveUpPressed_ = false;
    193         moveDownPressed_ = false;
    194         moveLeftPressed_ = false;
    195         moveRightPressed_ = false;
     273        moveUpPressed_      = false;
     274        moveDownPressed_    = false;
     275        moveLeftPressed_    = false;
     276        moveRightPressed_   = false;
    196277    }
    197278
     
    204285    if (hasLocalController())
    205286    {
     287        SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    206288        Vector3 velocity = getVelocity();
    207289        Vector3 position = getPosition();
     
    212294        if (position.z < -100) {
    213295            dead_ = true;
    214             SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    215296            SOBGame->setDone(true);
    216297        }
     
    221302            velocity.z = 0;
    222303            setVelocity(velocity);
    223             SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     304           
    224305            if (firePressed_)
    225306                SOBGame->restart();
     
    242323        else
    243324            particlespawner_->setVisible(false);
    244 
     325       
    245326
    246327        //If player hits space and collides against an object under him then jump
    247         if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 7.75 && collDisZ_ <+ 8.25)) {
    248             gravityAcceleration_ = 100.0;
    249             velocity.z = 110;
     328        if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 0 && collDisZ_ <+ 10)) {
     329            gravityAcceleration_ = 350;
     330            velocity.z = 175;
    250331        }
    251332
     
    274355        }
    275356
     357        //If moveUp pressed, fire a fireball
     358        if(moveUpPressed_ && (PowerUpCounter_ >= FireballPower) && fireallowed_)
     359        {
     360            spawnFireball();
     361            fireallowed_  = false;
     362            firecooldown_ = 0;
     363        }
     364
     365        //Increase the firecooldown
     366        if(firecooldown_> 0.5)
     367        {
     368            fireallowed_ = true;
     369        }
     370        if(!fireallowed_)
     371        {
     372            firecooldown_ += dt;
     373        }
    276374
    277375        //Again another EndOfLevel behavior
     
    283381            velocity.x = 0;
    284382            velocity.y = 20;
     383            setOrientation(Vector3::UNIT_Z, Degree(90));
    285384        }
    286385        if (reachedLvlEndState_ == 4) {
     386            //Highscore
     387            if (Highscore::exists()){
     388                    int score = SOBGame->getPoints();
     389                    if(score > Highscore::getInstance().getHighestScoreOfGame("Super Orxo Bros."))
     390                        Highscore::getInstance().storeHighscore("Super Orxo Bros.",score);
     391                        SOBGame->newHighscore=1;
     392
     393            }
    287394            lvlEnded_ = true;
    288395            dead_ = true;
     
    307414        }
    308415
    309 
    310 
    311 
    312     }
    313 
    314 
     416    }
    315417
    316418    // Reset key variables
    317     moveUpPressed_ = false;
    318     moveDownPressed_ = false;
    319     moveLeftPressed_ = false;
    320     moveRightPressed_ = false;
     419    moveUpPressed_      = false;
     420    moveDownPressed_    = false;
     421    moveLeftPressed_    = false;
     422    moveRightPressed_   = false;
    321423
    322424    isColliding_ = false;
     
    364466
    365467
    366 }
     468
     469// PRE: name is an existing name of a material. Example orxo_material for orxo_material.material in data_extern/materials
     470//      !!! PowerUpCounter_ has to be modified before changing the clothes!!!
     471// POST: clothes of body of player are changed to name
     472void SOBFigure::changeClothes(){
     473            // clothes: white (basic), red (one PowerUp), orange (Fireball enabled)
     474            std::string clothes[] = {"orxo_material", "orxo_material_gross", "orxo_material_fire"};
     475
     476            std::set<WorldEntity*> attachedObjects = this->getAttachedObjects();
     477            std::set<WorldEntity*>::iterator it;
     478            for (it = attachedObjects.begin(); it != attachedObjects.end(); ++it)
     479            {
     480                Model* FiguresModel = orxonox_cast<Model*>(*it);
     481                if (FiguresModel != nullptr)
     482                {
     483                    FiguresModel->setSubMaterial(clothes[PowerUpCounter_] , 4); // 4 is the body
     484                }
     485            }   
     486}
     487// PRE:
     488// POST: Player jumps out of the game, game is finished and can be restarted.
     489void SOBFigure::die(){
     490    Vector3 vel = getVelocity();
     491    vel.y = -80;
     492    vel.z = 200;
     493    setVelocity(vel);
     494    predead_= true;
     495    SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     496    SOBGame->setDone(true);
     497}
     498
     499}
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.h

    r11418 r11766  
    4646            virtual void boost(bool boost) override;
    4747            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
     48            void changeClothes();
     49            void spawnFireball();
     50            void die();
    4851
    4952            bool dead_;
     
    5457
    5558            //Soooo many declarations
    56             bool gotPowerUp_;
     59            bool fireallowed_;
     60
    5761            bool moveUpPressed_;
    5862            bool moveDownPressed_;
     
    6367            float timeSinceLastFire_;
    6468            float lastSpeed_z;
     69            float firecooldown_;
    6570            SOBCenterpoint* sobcenterpoint;
    6671            float pitch_;
    6772            bool isColliding_;
    6873            WorldEntity* particlespawner_;
     74            int PowerUpCounter_;
     75            int maxPowerUp_;
     76            int FireballPower;
    6977            int sgn(float x);
    7078            int reachedLvlEndState_;
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFlagstone.h

    r11416 r11766  
    2929/**
    3030    @file SOBFlagstone.h
    31     @brief Declaration of the SOBFlagstone class. This class is used for the flag - for everz 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get.
     31    @brief Declaration of the SOBFlagstone class.
     32            This class is used for the flag - for every 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get.
    3233    @ingroup SOB
    3334*/
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.cc

    r11416 r11766  
    6060        changeAllowed_ = true;
    6161        changedOn_ = 0.0;
     62        creator_ = nullptr;
     63        maxLifetime_ = 10;
     64        lifetime_ = 0;
    6265       
    6366    }
     
    9194    }
    9295
     96    void SOBGumba::setDirection(const bool direction)
     97    {
     98        if(direction)
     99        {
     100            goesRight_=true;
     101        }
     102        else
     103        {
     104            goesRight_=false;
     105        }
     106    }
    93107
     108    void SOBGumba::die(){
     109        Vector3 velocity = this->getVelocity();
     110        velocity.y = speed_;
     111        this->setVelocity(velocity);
     112    }
    94113
    95114    void SOBGumba::tick(float dt)
     
    100119            changedOn_+= dt;
    101120            // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions!
    102             if (changedOn_> 0.200) {
     121            if (changedOn_> 0.400) {
    103122                changeAllowed_ = true;
    104123                changedOn_ = 0.0;
     
    106125            }
    107126        }
    108        
     127   
    109128
    110129        int dir = 1;
     
    113132
    114133        Vector3 velocity = getVelocity();
     134        if(velocity.z > -1 && velocity.z < 1)
     135        {
     136            velocity.x = dir*speed_;
     137        }     
     138
    115139        velocity.z -= gravityAcceleration_*dt;
    116         velocity.x = dir*speed_;
    117140        setVelocity(velocity);
    118141
    119142        lastPos_ = getPosition();
     143
     144        if (creator_ != nullptr)
     145        {
     146            lifetime_ += dt;
     147            if(lifetime_>maxLifetime_)
     148            {
     149               
     150            }
     151        }
     152
     153        if(abs(this->getPosition().z) > 1000) delete this;
     154
    120155    }
    121 
    122 
    123156}
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.h

    r11416 r11766  
    5151            virtual void tick(float dt) override;
    5252
     53            void setDirection(const bool direction);
     54            void die();
    5355         
    5456            bool attachedToFigure_;
     
    6062
    6163            bool hasCollided_;
     64            SOBGumbaBoss* creator_;
    6265        protected:
    6366            float gravityAcceleration_;
     
    6871            bool changeAllowed_;
    6972            float changedOn_;
     73            float maxLifetime_;
     74            float lifetime_;
     75
    7076           
    7177    };
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBPrereqs.h

    r11699 r11766  
    7676    class SOBHUDInfo;
    7777    class SOBGumba;
     78    class SOBGumbaBoss;
    7879    class SOBFlagstone;
    7980    class SOBCastlestone;
  • code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBQBlock.cc

    r11416 r11766  
    3939#include "SOBMushroom.h"
    4040#include "SOBCoin.h"
     41#include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
     42
    4143
    4244namespace orxonox
     
    6264        //If you hit the QBlock, the visibility of all attached objects get inverted! Pretty easy way to create changing blocks :)
    6365        float v_z = otherObject->getVelocity().z;
    64         if (!used_ && v_z > 50.0) {
     66        int collDisZ_ = getPosition().z - contactPoint.getPositionWorldOnB().getZ();
     67        if (!used_ && v_z > 50.0 && collDisZ_ > 0) {
    6568            used_ = true;
    6669
  • code/branches/Presentation_HS17_merge/src/orxonox/graphics/Model.cc

    r11080 r11766  
     1
    12/*
    23 *   ORXONOX - the hottest 3D action shooter ever to exist
     
    4041#include "graphics/MeshLodInformation.h"
    4142#include "Level.h"
     43
    4244
    4345namespace orxonox
     
    155157        this->mesh_.setMaterial(this->materialName_);
    156158    }
     159
     160    // PRE: a valid  Ogre::Entity* entity with a valid subentity at index
     161    // POST: changed material of subentity at index to name
     162    void Model::setSubMaterial(const std::string& name, const int index){
     163        this->mesh_.setSubMaterial(name, index);
     164    }
     165
    157166
    158167    void Model::changedShadows()
  • code/branches/Presentation_HS17_merge/src/orxonox/graphics/Model.h

    r11080 r11766  
    8686                { return this->materialName_; }
    8787
     88            void setSubMaterial(const std::string& name, const int index);
     89
     90
    8891        protected:
    8992            /**
Note: See TracChangeset for help on using the changeset viewer.