Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 16, 2017, 4:03:17 PM (7 years ago)
Author:
varxth
Message:

improved power up of player

File:
1 edited

Legend:

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

    r11420 r11491  
    110110            mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once
    111111
     112            Vector3 scale = {1.2, 1.2, 1.2};
     113            this->setScale3D(scale);
     114            /*if (this->hasPhysics() && this->collisionShape_ != nullptr)
     115            {
     116             this->collisionShape_->setScale3D(scale);
     117            }*/
     118
     119        }
    112120        //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
     121
     122         else if (gumba != nullptr && !(gumba->hasCollided_)) {
     123
     124            //If player doesn't jump on its head, kill it, else, kill the player
    116125            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);
     126                // If player hasn't a power up, he dies. Else he shrinks and the gumba dies.
     127                if(!gotPowerUp_){
     128                    Vector3 vel = getVelocity();
     129                    vel.y = -80;
     130                    vel.z = 200;
     131                    setVelocity(vel);
     132                    predead_=true;
     133                    SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     134                    SOBGame->setDone(true);
     135                } else{
     136                    gotPowerUp_ = false;
     137                   
     138                    Vector3 scale = {1, 1, 1};
     139                    this->setScale3D(scale);
     140                    /*if (this->hasPhysics() && this->collisionShape_ != nullptr)
     141                    {
     142                     this->collisionShape_->setScale3D(scale);
     143                    }*/
     144
     145                    gumba->destroyLater();
     146                    gumba->hasCollided_ = true;
     147                }
    124148
    125149          } else {
Note: See TracChangeset for help on using the changeset viewer.