Changeset 11575 for code/branches/SOBv2_HS17/src
- Timestamp:
- Nov 20, 2017, 3:21:35 PM (7 years ago)
- Location:
- code/branches/SOBv2_HS17/src/modules/superorxobros
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
r11573 r11575 42 42 #include "SOBMushroom.h" 43 43 #include "SOBGumba.h" 44 #include "SOBFireball.h" 44 45 #include "SOB.h" 45 46 #include "SOBFlagstone.h" … … 103 104 104 105 //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); 109 111 110 112 //Check if otherObject is a powerup … … 122 124 } 123 125 126 124 127 //Check if otherObject is a Gumba (that walking enemies) 125 128 … … 130 133 // If player hasn't a power up, he dies. Else he shrinks and the gumba dies. 131 134 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(); 139 136 } else{ 140 137 gotPowerUp_ = false; … … 158 155 } 159 156 157 else if (fireball != nullptr && !(fireball->hasCollided_)){ 158 this-> die(); 159 } 160 160 161 //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 161 162 if (reachedLvlEndState_ == 0 && flagstone != nullptr && !(flagstone->hasCollided_)) { … … 440 441 } 441 442 442 } 443 void 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 } -
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.h
r11573 r11575 48 48 void changeClothes(std::string& name); 49 49 void spawnFireball(); 50 void die(); 50 51 51 52 bool dead_; -
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc
r11573 r11575 67 67 collDisX_ = 0; 68 68 collDisZ_ = 0; 69 70 orxout() << "fireball existed" << endl; 71 69 hitCounter_ = 0; 72 70 73 71 } … … 90 88 SOBGumba* gumba = orxonox_cast<SOBGumba*>(otherObject); 91 89 90 92 91 if(gumba!=nullptr && !(gumba->hasCollided_)) //if other object is a Gumba, kill the Gumba and add score and destroy the fireball 93 92 { … … 99 98 this->hasCollided_ = true; 100 99 } 100 101 101 102 //collision with either top or bottom of a block 102 103 else if(changeAllowed_ && (abs(collDisX_)<=abs(collDisZ_))) … … 104 105 changeAllowed_ = false; 105 106 Vector3 velocity = getVelocity(); 106 orxout() << "before: velocity in z = " << velocity.z << endl;107 107 velocity.z = -velocity.z; 108 orxout() << "after: velocity in z = " << velocity.z << endl;108 109 109 110 110 setVelocity(velocity); … … 114 114 else if(changeAllowed_ && (abs(collDisX_)>abs(collDisZ_))) 115 115 { 116 orxout() << "collision with the vertical side of a block " << endl;117 118 116 changeAllowed_ = false; 119 117 goesRight_=!goesRight_; 120 118 } 121 119 120 hitCounter_++; 122 121 123 122 return true; … … 154 153 velocity.x = dir*speed_; 155 154 velocity.y = 0; 155 if(hitCounter_ >= 3) velocity.y = 50; 156 156 setVelocity(velocity); 157 157 158 158 lastPos_ = getPosition(); 159 160 if(abs(this->getPosition().z) > 1000) delete this; 159 161 160 162 } -
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.h
r11573 r11575 72 72 float changedOn_; 73 73 int hitCounter_; 74 74 75 75 76
Note: See TracChangeset
for help on using the changeset viewer.