Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 27, 2017, 3:08:16 PM (7 years ago)
Author:
jkindle
Message:

Added a HUD and type to QBlocks

File:
1 edited

Legend:

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

    r11402 r11405  
    4141
    4242#include "SOBMushroom.h"
     43#include "SOB.h"
    4344
    4445namespace orxonox
     
    6667
    6768        dead_ = false;
     69        gotPowerUp_ = false;
     70       
    6871        setAngularFactor(0.0);
    69          this->enableCollisionCallback();
     72        this->enableCollisionCallback();
    7073    }
    7174
     
    7679        isColliding_ = true;
    7780        SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject);
    78         if (mush != nullptr) {
    79             orxout() << "YEPPIE" << endl;
    80             //DESTROY THE OTHER OBJECT otherObject.destroyLater();
    81         }
    82 
    83 return true;
     81        // ADD ANOTHER OBJECT FOR BAD GUMBAS AND REMOVE POWERUP OR KILL PLAYER ON COLLISION WITHOUT Z-ACCELERATION
     82        if (mush != nullptr && !(mush->hasCollided_)) {
     83            otherObject->destroyLater();
     84            gotPowerUp_ = true;
     85            SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
     86            SOBGame->addMushroom();
     87            mush->hasCollided_ = true;
     88
     89        }
     90
     91        return true;
    8492    }
    8593
     
    101109            for (WorldEntity* object : this->getAttachedObjects())
    102110            {
    103                  if (object->isA(Class(ParticleSpawner)))
    104                     particlespawner_ = object;
    105                    
    106             }
    107  
    108         }
    109        
    110 
    111 
    112 
    113 
    114 
    115         if (firePressed_ == false) {
    116              gravityAcceleration_ = 350.0;
    117 
    118         }
    119 
    120         if (hasLocalController())
    121         {
    122           Vector3 velocity = getVelocity();
    123           Vector3 position = getPosition();
    124 
    125 
    126           if (position.z < -100)
    127             dead_ = true;
    128 
    129           if (dead_) {
    130             velocity.x = 0;
    131             velocity.z = 0;
    132             setVelocity(velocity);
    133             return;
    134         }
    135 
    136 
    137         int maxvelocity_x = 100;
    138         int speedAddedPerTick = 5;
    139         int camMaxOffset = 25;
    140 
    141         timeSinceLastFire_ += dt;
    142         lastSpeed_z = velocity.z;
     111               if (object->isA(Class(ParticleSpawner)))
     112                particlespawner_ = object;
     113
     114        }
     115
     116    }
     117
     118
     119
     120
     121
     122
     123    if (firePressed_ == false) {
     124       gravityAcceleration_ = 350.0;
     125
     126   }
     127
     128   if (hasLocalController())
     129   {
     130      Vector3 velocity = getVelocity();
     131      Vector3 position = getPosition();
     132
     133
     134      if (position.z < -100)
     135        dead_ = true;
     136
     137    if (dead_) {
     138        velocity.x = 0;
     139        velocity.z = 0;
     140        setVelocity(velocity);
     141        return;
     142    }
     143
     144
     145    int maxvelocity_x = 100;
     146    int speedAddedPerTick = 5;
     147    int camMaxOffset = 25;
     148
     149    timeSinceLastFire_ += dt;
     150    lastSpeed_z = velocity.z;
    143151
    144152
    145153
    146154        //Handle the rocket fire from the jetpack
    147         if (velocity.z > 40)
    148             particlespawner_->setVisible(true);
    149         else
    150             particlespawner_->setVisible(false);
     155    if (velocity.z > 40)
     156        particlespawner_->setVisible(true);
     157    else
     158        particlespawner_->setVisible(false);
    151159
    152160        //If player hits space and does not move in z-dir
    153         if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
    154             gravityAcceleration_ = 100.0;
     161    if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
     162        gravityAcceleration_ = 100.0;
    155163            velocity.z = 110; //150
    156164        }
     
    163171        if (moveRightPressed_) {
    164172            if (rot < 0.0)
    165                     setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
     173                setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
    166174
    167175            if (std::abs(velocity.x) < maxvelocity_x) {
     
    178186        } else if (moveLeftPressed_) {
    179187            if (rot >= 0.0)
    180                     setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
     188                setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
    181189
    182190            if (std::abs(velocity.x) < maxvelocity_x) {
     
    200208            cam->setPosition(campos);
    201209        }
    202            if (campos.x - camMaxOffset > position.x) {
     210        if (campos.x - camMaxOffset > position.x) {
    203211            campos.x = position.x + camMaxOffset;
    204212            cam->setPosition(campos);
Note: See TracChangeset for help on using the changeset viewer.