Changeset 11783 for code/trunk/src/modules/superorxobros
- Timestamp:
- Feb 20, 2018, 12:14:40 AM (7 years ago)
- Location:
- code/trunk
- Files:
-
- 2 deleted
- 25 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/superorxobros/CMakeLists.txt
- Property svn:eol-style set to native
r11416 r11783 9 9 SOBHUDInfo.cc 10 10 SOBGumba.cc 11 SOBFireball.cc 11 12 SOBFlagstone.cc 12 13 SOBCastlestone.cc 13 14 SOBCoin.cc 15 SOBGumbaBoss.cc 14 16 15 17 ) -
code/trunk/src/modules/superorxobros/SOB.cc
- Property svn:eol-style set to native
r11418 r11783 44 44 #include "SOBFigure.h" 45 45 #include "graphics/Camera.h" 46 #include "Highscore.h" 46 47 47 48 … … 49 50 namespace orxonox 50 51 { 51 52 bool newHighscore=0; 52 53 RegisterUnloadableClass(SOB); 53 54 … … 59 60 { 60 61 RegisterObject(SOB); 61 camera = nullptr;62 62 63 63 this->center_ = nullptr; … … 68 68 timeLeft_=400.0; 69 69 done_ = true; 70 newHighscore = false; 70 71 lvl_ = 1; 71 72 … … 78 79 SOB::~SOB() 79 80 { 80 if (this->isInitialized())81 this->cleanup();82 81 } 83 84 void SOB::cleanup()85 {86 camera = nullptr;87 }88 89 90 82 91 83 void SOB::start() … … 99 91 } 100 92 101 center_->attach(figure_);102 93 figure_->setPosition(0, 0, 0); 103 94 } … … 112 103 Gametype::start(); 113 104 114 if (figure_ != nullptr)115 {116 camera = figure_->getCamera();117 }118 119 105 } 120 106 121 107 void SOB::end() 122 108 { 123 cleanup();124 109 GSLevel::startMainMenu(); 125 110 Deathmatch::end(); 126 111 } 127 112 128 113 void SOB::restart() { 129 cleanup();130 131 114 // HACK - only method I found to simply reload the level 132 115 Game::getInstance().popState(); … … 167 150 if (this->figure_ != nullptr && figure_->lvlEnded_) { 168 151 std::stringstream a; 169 a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart"; 152 if(!newHighscore){ 153 a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart"; 154 } 155 else{ 156 a << "Congrats, new Highscore! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart"; 157 } 170 158 info_ =a.str(); 171 159 … … 181 169 //The time on the HUD 182 170 if (!done_) 183 timeLeft_-=dt*2.5 ;171 timeLeft_-=dt*2.5f; 184 172 } 185 173 -
code/trunk/src/modules/superorxobros/SOB.h
- Property svn:eol-style set to native
r11418 r11783 76 76 points_+=100; 77 77 } 78 void addGumbaBoss() { 79 points_+=5000; 80 } 78 81 void addPoints(int poi) { 79 82 points_+=poi; 80 83 } 81 84 int getTimeLeft() { 82 return timeLeft_;85 return (int) timeLeft_; 83 86 } 84 87 std::string getInfoText() { … … 103 106 104 107 WeakPtr<SOBCenterpoint> center_; 108 bool newHighscore; 105 109 106 110 protected: 107 111 108 112 109 void cleanup(); //!< Cleans up the Gametype110 113 WeakPtr<SOBFigure> figure_; 111 WeakPtr<Camera> camera;112 114 int points_; 113 115 int coins_; -
code/trunk/src/modules/superorxobros/SOBCastlestone.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBCastlestone.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBCenterpoint.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBCenterpoint.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBCoin.cc
- Property svn:eol-style set to native
r11420 r11783 49 49 setAngularFactor(0.0); 50 50 51 speed_ = 0; 52 lifetime_ = 0; 51 53 } 52 54 … … 67 69 lifetime_-=dt; 68 70 69 if (lifetime_ < +0) {71 if (lifetime_ < 0) { 70 72 destroyLater(); 71 73 } -
code/trunk/src/modules/superorxobros/SOBCoin.h
- Property svn:eol-style set to native
r11416 r11783 50 50 51 51 52 bool attachedToFigure_;53 54 52 void setLifetime(const float lt) 55 53 { this->lifetime_ = lt; } -
code/trunk/src/modules/superorxobros/SOBFigure.cc
- Property svn:eol-style set to native
r11420 r11783 23 23 * Julien Kindle 24 24 * Co-authors: 25 * Noah Zarro 26 * Theo von Arx 25 27 * 26 28 * … … 39 41 #include "graphics/Camera.h" 40 42 #include "graphics/ParticleSpawner.h" 43 #include <OgreMath.h> 41 44 42 45 #include "SOBMushroom.h" 43 46 #include "SOBGumba.h" 47 #include "SOBGumbaBoss.h" 48 #include "SOBFireball.h" 44 49 #include "SOB.h" 45 50 #include "SOBFlagstone.h" 46 51 #include "SOBCastlestone.h" 52 #include "SOBFireball.h" 53 #include "Highscore.h" 47 54 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 48 55 … … 59 66 60 67 //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 moveRightPressed_ = false; 72 firePressed_ = false; 73 collDisZ_ = 0; 74 67 75 //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 timeCounter_ = 0; 72 79 73 80 //Properties of player 74 gotPowerUp_ = false; 75 isColliding_ = true;76 particlespawner_ = NULL;81 82 isColliding_ = true; 83 particlespawner_ = NULL; 77 84 78 85 //Properties of players life 79 predead_ = false;80 dead_ = false;81 lvlEnded_ = false;86 predead_ = false; 87 dead_ = false; 88 lvlEnded_ = false; 82 89 reachedLvlEndState_ = 0; 90 91 // Properties concerning PowerUps and items 92 PowerUpCounter_ = 0; 93 maxPowerUp_ = 2; 94 FireballPower = 2; 95 //Properties of fireing Fireballs, NOTE! fireballs are fired with the moveUP Key, not with the fire key 96 fireallowed_ = true; 97 firecooldown_ = 0; 83 98 84 99 … … 97 112 98 113 //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 114 SOBMushroom* mush = orxonox_cast<SOBMushroom*> (otherObject); 115 SOBGumba* gumba = orxonox_cast<SOBGumba*> (otherObject); 116 SOBGumbaBoss* gumbaBoss = orxonox_cast<SOBGumbaBoss*> (otherObject); 117 SOBFlagstone* flagstone = orxonox_cast<SOBFlagstone*> (otherObject); 118 SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*> (otherObject); 119 SOBFireball* fireball = orxonox_cast<SOBFireball*> (otherObject); 120 SOB* SOBGame = orxonox_cast<SOB*> (getGametype()); 121 122 123 //Check if otherObject is a powerup-mushroom 105 124 if (mush != nullptr && !(mush->hasCollided_)) { 106 125 otherObject->destroyLater(); 107 gotPowerUp_ = true; 108 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); //Get the Gametype 126 127 PowerUpCounter_++; 128 if(PowerUpCounter_ > maxPowerUp_) PowerUpCounter_ = maxPowerUp_; // you had already the max 129 else this->changeClothes(); 130 109 131 SOBGame->addMushroom(); // Tell the gametype to increase points 110 132 mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once 133 134 135 } 136 137 111 138 112 139 //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 140 141 else if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) { 142 143 //If player jumps on its head, kill the Gumba, else, kill the player 116 144 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); 145 // If player hasn't a power up, he dies. Else he shrinks and the gumba dies. 146 if(PowerUpCounter_ == 0){ 147 this->die(); 148 } 149 else{ 150 PowerUpCounter_--; 151 this->changeClothes(); 152 153 gumba->destroyLater(); 154 gumba->hasCollided_ = true; 155 } 124 156 125 157 } else { 126 158 gumba->destroyLater(); 127 159 gumba->hasCollided_ = true; 128 SOB* SOBGame = orxonox_cast<SOB*>(getGametype());129 160 SOBGame->addGumba(); 130 161 131 162 132 } 133 } 163 } 164 } 165 else if (gumbaBoss != nullptr && !(gumbaBoss->hasCollided_)) { 166 if (getVelocity().z >= -20) { 167 // If player hasn't a power up, he dies. Else he dies directly. 168 this->die(); 169 } 170 171 else { 172 gumbaBoss->destroyLater(); 173 gumbaBoss->hasCollided_ = true; 174 SOBGame->addGumbaBoss(); 175 } 176 } 177 else if (fireball != nullptr && !(fireball->hasCollided_)){ 178 if(PowerUpCounter_ == 0){ 179 this->die(); 180 } 181 PowerUpCounter_--; 182 this->changeClothes(); 183 fireball->destroyLater(); 184 } 134 185 135 186 //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 … … 137 188 flagstone->hasCollided_ = true; 138 189 reachedLvlEndState_ = 1; 139 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 190 140 191 SOBGame->setDone(true); 141 192 SOBGame->addPoints(flagstone->getPoints()); … … 159 210 } 160 211 212 //Function to spawn the Fireball 213 void SOBFigure::spawnFireball() { 214 SOBCenterpoint* center_ = ((SOB*)getGametype())->center_; 215 216 SOBFireball* ball = new SOBFireball(center_->getContext()); 217 Vector3 spawnpos = this->getWorldPosition(); 218 spawnpos.z += 0; 219 220 if (ball != nullptr && center_ != nullptr) 221 { 222 ball->addTemplate("fireball"); 223 bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6)); 224 ball->setDirection(direction); 225 if(direction) 226 { 227 spawnpos.x+=10; 228 } 229 else 230 { 231 spawnpos.x-=10; 232 } 233 ball->setPosition(spawnpos); 234 235 } 236 } 237 161 238 //For those of you who don't have an idea: the tick function is called about 50 times/sec 162 239 void SOBFigure::tick(float dt) … … 166 243 167 244 bool inputAllowed = true; 245 //SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 168 246 169 247 //the particle spawner that generates the fire from the backpack when pressed … … 174 252 particlespawner_ = object; 175 253 } 176 } 254 255 } 256 177 257 178 258 … … 190 270 //if input blocked, then cancel every movement operation 191 271 if (!inputAllowed) { 192 moveUpPressed_ = false;193 moveDownPressed_ = false;194 moveLeftPressed_ = false;195 moveRightPressed_ = false;272 moveUpPressed_ = false; 273 moveDownPressed_ = false; 274 moveLeftPressed_ = false; 275 moveRightPressed_ = false; 196 276 } 197 277 … … 204 284 if (hasLocalController()) 205 285 { 286 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 206 287 Vector3 velocity = getVelocity(); 207 288 Vector3 position = getPosition(); … … 212 293 if (position.z < -100) { 213 294 dead_ = true; 214 SOB* SOBGame = orxonox_cast<SOB*>(getGametype());215 295 SOBGame->setDone(true); 216 296 } … … 221 301 velocity.z = 0; 222 302 setVelocity(velocity); 223 SOB* SOBGame = orxonox_cast<SOB*>(getGametype());303 224 304 if (firePressed_) 225 305 SOBGame->restart(); … … 242 322 else 243 323 particlespawner_->setVisible(false); 244 324 245 325 246 326 //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 = 1 10;327 if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 0 && collDisZ_ <+ 10)) { 328 gravityAcceleration_ = 350; 329 velocity.z = 175; 250 330 } 251 331 … … 274 354 } 275 355 356 //If moveUp pressed, fire a fireball 357 if(moveUpPressed_ && (PowerUpCounter_ >= FireballPower) && fireallowed_) 358 { 359 spawnFireball(); 360 fireallowed_ = false; 361 firecooldown_ = 0; 362 } 363 364 //Increase the firecooldown 365 if(firecooldown_> 0.5) 366 { 367 fireallowed_ = true; 368 } 369 if(!fireallowed_) 370 { 371 firecooldown_ += dt; 372 } 276 373 277 374 //Again another EndOfLevel behavior … … 283 380 velocity.x = 0; 284 381 velocity.y = 20; 382 setOrientation(Vector3::UNIT_Z, Degree(90)); 285 383 } 286 384 if (reachedLvlEndState_ == 4) { 385 //Highscore 386 if (Highscore::exists()) 387 { 388 int score = SOBGame->getPoints(); 389 bool isHighScore = Highscore::getInstance().storeScore("Super Orxo Bros.", score, this->getPlayer()); 390 SOBGame->newHighscore = isHighScore; 391 } 287 392 lvlEnded_ = true; 288 393 dead_ = true; … … 307 412 } 308 413 309 310 311 312 } 313 314 414 } 315 415 316 416 // Reset key variables 317 moveUpPressed_ = false;318 moveDownPressed_ = false;319 moveLeftPressed_ = false;320 moveRightPressed_ = false;417 moveUpPressed_ = false; 418 moveDownPressed_ = false; 419 moveLeftPressed_ = false; 420 moveRightPressed_ = false; 321 421 322 422 isColliding_ = false; … … 364 464 365 465 366 } 466 467 // PRE: name is an existing name of a material. Example orxo_material for orxo_material.material in data_extern/materials 468 // !!! PowerUpCounter_ has to be modified before changing the clothes!!! 469 // POST: clothes of body of player are changed to name 470 void SOBFigure::changeClothes(){ 471 // clothes: white (basic), red (one PowerUp), orange (Fireball enabled) 472 std::string clothes[] = {"orxo_material", "orxo_material_gross", "orxo_material_fire"}; 473 474 std::set<WorldEntity*> attachedObjects = this->getAttachedObjects(); 475 std::set<WorldEntity*>::iterator it; 476 for (it = attachedObjects.begin(); it != attachedObjects.end(); ++it) 477 { 478 Model* FiguresModel = orxonox_cast<Model*>(*it); 479 if (FiguresModel != nullptr) 480 { 481 FiguresModel->setSubMaterial(clothes[PowerUpCounter_] , 4); // 4 is the body 482 } 483 } 484 } 485 // PRE: 486 // POST: Player jumps out of the game, game is finished and can be restarted. 487 void SOBFigure::die(){ 488 Vector3 vel = getVelocity(); 489 vel.y = -80; 490 vel.z = 200; 491 setVelocity(vel); 492 predead_= true; 493 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 494 SOBGame->setDone(true); 495 } 496 497 } -
code/trunk/src/modules/superorxobros/SOBFigure.h
- Property svn:eol-style set to native
r11418 r11783 46 46 virtual void boost(bool boost) override; 47 47 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 48 void changeClothes(); 49 void spawnFireball(); 50 void die(); 48 51 49 52 bool dead_; … … 54 57 55 58 //Soooo many declarations 56 bool gotPowerUp_; 59 bool fireallowed_; 60 57 61 bool moveUpPressed_; 58 62 bool moveDownPressed_; … … 63 67 float timeSinceLastFire_; 64 68 float lastSpeed_z; 65 SOBCenterpoint* sobcenterpoint; 66 float pitch_; 69 float firecooldown_; 67 70 bool isColliding_; 68 71 WorldEntity* particlespawner_; 72 int PowerUpCounter_; 73 int maxPowerUp_; 74 int FireballPower; 69 75 int sgn(float x); 70 76 int reachedLvlEndState_; -
code/trunk/src/modules/superorxobros/SOBFlagstone.cc
- Property svn:eol-style set to native
r11416 r11783 52 52 53 53 hasCollided_=false; 54 54 points_=0; 55 55 56 56 } -
code/trunk/src/modules/superorxobros/SOBFlagstone.h
- Property svn:eol-style set to native
r11416 r11783 29 29 /** 30 30 @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. 32 33 @ingroup SOB 33 34 */ -
code/trunk/src/modules/superorxobros/SOBGumba.cc
- Property svn:eol-style set to native
r11416 r11783 48 48 RegisterObject(SOBGumba); 49 49 50 attachedToFigure_ = false;51 50 setAngularFactor(0.0); 52 figure_ = nullptr;53 51 this->enableCollisionCallback(); 54 52 gravityAcceleration_ = 350.0; … … 56 54 hasCollided_=false; 57 55 goesRight_ = true; 58 lastPos_ = getPosition();59 lastPos_.x -= 20;60 56 changeAllowed_ = true; 61 57 changedOn_ = 0.0; 58 creator_ = nullptr; 59 maxLifetime_ = 10; 60 lifetime_ = 0; 62 61 63 62 } … … 86 85 87 86 88 void SOBGumba::set Figure(SOBFigure* newFigure)87 void SOBGumba::setDirection(const bool direction) 89 88 { 90 figure_ = newFigure; 89 if(direction) 90 { 91 goesRight_=true; 92 } 93 else 94 { 95 goesRight_=false; 96 } 91 97 } 92 98 93 99 void SOBGumba::die(){ 100 Vector3 velocity = this->getVelocity(); 101 velocity.y = speed_; 102 this->setVelocity(velocity); 103 } 94 104 95 105 void SOBGumba::tick(float dt) … … 100 110 changedOn_+= dt; 101 111 // 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) {112 if (changedOn_> 0.400) { 103 113 changeAllowed_ = true; 104 114 changedOn_ = 0.0; … … 106 116 } 107 117 } 108 118 109 119 110 120 int dir = 1; … … 113 123 114 124 Vector3 velocity = getVelocity(); 125 if(velocity.z > -1 && velocity.z < 1) 126 { 127 velocity.x = dir*speed_; 128 } 129 115 130 velocity.z -= gravityAcceleration_*dt; 116 velocity.x = dir*speed_;117 131 setVelocity(velocity); 118 132 119 lastPos_ = getPosition(); 133 if (creator_ != nullptr) 134 { 135 lifetime_ += dt; 136 if(lifetime_>maxLifetime_) 137 { 138 139 } 140 } 141 142 if(abs(this->getPosition().z) > 1000) this->destroyLater(); 143 120 144 } 121 122 123 145 } -
code/trunk/src/modules/superorxobros/SOBGumba.h
- Property svn:eol-style set to native
r11416 r11783 47 47 SOBGumba(Context* context); 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 virtual void setFigure(SOBFigure* newFigure);50 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 51 50 virtual void tick(float dt) override; 52 51 52 void setDirection(const bool direction); 53 void die(); 53 54 54 bool attachedToFigure_;55 56 55 void setSpeed(const float speed) 57 56 { this->speed_ = speed; } … … 60 59 61 60 bool hasCollided_; 61 SOBGumbaBoss* creator_; 62 62 protected: 63 63 float gravityAcceleration_; 64 64 float speed_; 65 WeakPtr<SOBFigure> figure_;66 65 bool goesRight_; 67 Vector3 lastPos_;68 66 bool changeAllowed_; 69 67 float changedOn_; 68 float maxLifetime_; 69 float lifetime_; 70 70 71 71 72 }; -
code/trunk/src/modules/superorxobros/SOBHUDInfo.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBHUDInfo.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBItem.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBItem.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/superorxobros/SOBMushroom.cc
- Property svn:eol-style set to native
r11416 r11783 48 48 RegisterObject(SOBMushroom); 49 49 50 attachedToFigure_ = false;51 50 setAngularFactor(0.0); 52 figure_ = nullptr;53 51 this->enableCollisionCallback(); 54 52 gravityAcceleration_ = 350.0; … … 56 54 hasCollided_=false; 57 55 goesRight_ = true; 58 lastPos_ = getPosition();59 lastPos_.x -= 20;60 56 changeAllowed_ = true; 61 57 changedOn_ = 0.0; … … 86 82 87 83 88 void SOBMushroom::setFigure(SOBFigure* newFigure)89 {90 figure_ = newFigure;91 }92 93 94 95 84 void SOBMushroom::tick(float dt) 96 85 { … … 104 93 changedOn_ = 0.0; 105 94 95 } 106 96 } 107 }108 97 109 98 … … 116 105 velocity.x = dir*speed_; 117 106 setVelocity(velocity); 118 119 120 121 lastPos_ = getPosition(); 122 } 107 } 123 108 124 109 -
code/trunk/src/modules/superorxobros/SOBMushroom.h
- Property svn:eol-style set to native
r11416 r11783 47 47 SOBMushroom(Context* context); 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 virtual void setFigure(SOBFigure* newFigure);50 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 51 50 virtual void tick(float dt) override; 52 51 53 52 54 bool attachedToFigure_;55 56 53 void setSpeed(const float speed) 57 54 { this->speed_ = speed; } … … 63 60 float gravityAcceleration_; 64 61 float speed_; 65 WeakPtr<SOBFigure> figure_;66 62 bool goesRight_; 67 Vector3 lastPos_;68 63 bool changeAllowed_; 69 64 float changedOn_; -
code/trunk/src/modules/superorxobros/SOBPrereqs.h
- Property svn:eol-style set to native
r11699 r11783 76 76 class SOBHUDInfo; 77 77 class SOBGumba; 78 class SOBGumbaBoss; 78 79 class SOBFlagstone; 79 80 class SOBCastlestone; -
code/trunk/src/modules/superorxobros/SOBQBlock.cc
- Property svn:eol-style set to native
r11416 r11783 39 39 #include "SOBMushroom.h" 40 40 #include "SOBCoin.h" 41 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 42 41 43 42 44 namespace orxonox … … 62 64 //If you hit the QBlock, the visibility of all attached objects get inverted! Pretty easy way to create changing blocks :) 63 65 float v_z = otherObject->getVelocity().z; 64 if (!used_ && v_z > 50.0) { 66 float collDisZ_ = getPosition().z - contactPoint.getPositionWorldOnB().getZ(); 67 if (!used_ && v_z > 50.0 && collDisZ_ > 0) { 65 68 used_ = true; 66 69 -
code/trunk/src/modules/superorxobros/SOBQBlock.h
- Property svn:eol-style set to native
Note: See TracChangeset
for help on using the changeset viewer.