Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 20, 2017, 3:21:35 PM (6 years ago)
Author:
varxth
Message:

merged Fireball and player

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc

    r11573 r11575  
    4242#include "SOBMushroom.h"
    4343#include "SOBGumba.h"
     44#include "SOBFireball.h"
    4445#include "SOB.h"
    4546#include "SOBFlagstone.h"
     
    103104
    104105        //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr
    105         SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject);
    106         SOBGumba* gumba = orxonox_cast<SOBGumba*>(otherObject);
    107         SOBFlagstone* flagstone = orxonox_cast<SOBFlagstone*>(otherObject);
    108         SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*>(otherObject);
     106        SOBMushroom*    mush        = orxonox_cast<SOBMushroom*>    (otherObject);
     107        SOBGumba*       gumba       = orxonox_cast<SOBGumba*>       (otherObject);
     108        SOBFlagstone*   flagstone   = orxonox_cast<SOBFlagstone*>   (otherObject);
     109        SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*> (otherObject);
     110        SOBFireball* fireball       = orxonox_cast<SOBFireball*>    (otherObject);
    109111
    110112        //Check if otherObject is a powerup
     
    122124        }
    123125       
     126
    124127        //Check if otherObject is a Gumba (that walking enemies)
    125128
     
    130133                // If player hasn't a power up, he dies. Else he shrinks and the gumba dies.
    131134                if(!gotPowerUp_){
    132                     Vector3 vel = getVelocity();
    133                     vel.y = -80;
    134                     vel.z = 200;
    135                     setVelocity(vel);
    136                     predead_=true;
    137                     SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
    138                     SOBGame->setDone(true);
     135                    this->die();
    139136                } else{
    140137                    gotPowerUp_ = false;
     
    158155    }
    159156
     157        else if (fireball != nullptr && !(fireball->hasCollided_)){
     158            this-> die();
     159        }
     160
    160161    //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
    161162    if (reachedLvlEndState_ == 0 && flagstone != nullptr && !(flagstone->hasCollided_)) {
     
    440441}
    441442
    442 }
     443void SOBFigure::die(){
     444    Vector3 vel = getVelocity();
     445    vel.y = -80;
     446    vel.z = 200;
     447    setVelocity(vel);
     448    predead_=true;
     449    SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     450    SOBGame->setDone(true);
     451}
     452
     453}
Note: See TracChangeset for help on using the changeset viewer.