- Timestamp:
- Apr 27, 2017, 3:08:16 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
r11402 r11405 41 41 42 42 #include "SOBMushroom.h" 43 #include "SOB.h" 43 44 44 45 namespace orxonox … … 66 67 67 68 dead_ = false; 69 gotPowerUp_ = false; 70 68 71 setAngularFactor(0.0); 69 72 this->enableCollisionCallback(); 70 73 } 71 74 … … 76 79 isColliding_ = true; 77 80 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; 84 92 } 85 93 … … 101 109 for (WorldEntity* object : this->getAttachedObjects()) 102 110 { 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 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; 143 151 144 152 145 153 146 154 //Handle the rocket fire from the jetpack 147 148 149 150 155 if (velocity.z > 40) 156 particlespawner_->setVisible(true); 157 else 158 particlespawner_->setVisible(false); 151 159 152 160 //If player hits space and does not move in z-dir 153 154 161 if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) { 162 gravityAcceleration_ = 100.0; 155 163 velocity.z = 110; //150 156 164 } … … 163 171 if (moveRightPressed_) { 164 172 if (rot < 0.0) 165 173 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6)); 166 174 167 175 if (std::abs(velocity.x) < maxvelocity_x) { … … 178 186 } else if (moveLeftPressed_) { 179 187 if (rot >= 0.0) 180 188 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6)); 181 189 182 190 if (std::abs(velocity.x) < maxvelocity_x) { … … 200 208 cam->setPosition(campos); 201 209 } 202 210 if (campos.x - camMaxOffset > position.x) { 203 211 campos.x = position.x + camMaxOffset; 204 212 cam->setPosition(campos);
Note: See TracChangeset
for help on using the changeset viewer.