Changeset 11573 for code/branches/SOBv2_HS17/src
- Timestamp:
- Nov 20, 2017, 3:11:07 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
r11567 r11573 45 45 #include "SOBFlagstone.h" 46 46 #include "SOBCastlestone.h" 47 #include "SOBFireball.h" 47 48 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h> 48 49 … … 83 84 reachedLvlEndState_ = 0; 84 85 86 //Properties of fireing Fireballs, NOTE! fireballs are fired with the moveUP Key, not with the fire key 87 fireallowed_=true; 88 firecooldown_=0; 89 85 90 86 91 setAngularFactor(0.0); //Means player doesn't turn on collision, so he doesn't fall over while walking over the ground … … 110 115 SOBGame->addMushroom(); // Tell the gametype to increase points 111 116 mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once 112 113 117 114 118 // now, change the clothes of the Figure to red … … 180 184 } 181 185 186 //Function to spawn the Fireball 187 void SOBFigure::spawnFireball() { 188 SOBCenterpoint* center_ = ((SOB*)getGametype())->center_; 189 190 SOBFireball* ball = new SOBFireball(center_->getContext()); 191 Vector3 spawnpos = this->getWorldPosition(); 192 spawnpos.z += 0; 193 194 if (ball != nullptr && center_ != nullptr) 195 { 196 ball->addTemplate("fireball"); 197 ball->setPosition(spawnpos); 198 199 } 200 } 201 182 202 //For those of you who don't have an idea: the tick function is called about 50 times/sec 183 203 void SOBFigure::tick(float dt) … … 295 315 } 296 316 317 //If moveUp pressed, fire a fireball 318 if(moveUpPressed_ && gotPowerUp_ && fireallowed_) 319 { 320 spawnFireball(); 321 fireallowed_=false; 322 firecooldown_=0; 323 } 324 325 //Increase the firecooldown 326 if(firecooldown_>0.5) 327 { 328 fireallowed_=true; 329 } 330 if(!fireallowed_) 331 { 332 firecooldown_+=dt; 333 } 297 334 298 335 //Again another EndOfLevel behavior -
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.h
r11538 r11573 47 47 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 48 48 void changeClothes(std::string& name); 49 void spawnFireball(); 49 50 50 51 bool dead_; … … 55 56 56 57 //Soooo many declarations 58 bool fireallowed_; 57 59 bool gotPowerUp_; 58 60 bool moveUpPressed_; … … 64 66 float timeSinceLastFire_; 65 67 float lastSpeed_z; 68 float firecooldown_; 66 69 SOBCenterpoint* sobcenterpoint; 67 70 float pitch_; -
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc
r11569 r11573 67 67 collDisX_ = 0; 68 68 collDisZ_ = 0; 69 hitCounter_ = 0;70 69 71 70 orxout() << "fireball existed" << endl; … … 121 120 } 122 121 123 hitCounter_++;124 125 122 126 123 return true; -
code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.h
r11570 r11573 64 64 bool hasCollided_; 65 65 protected: 66 int hitCounter_; //counts how many times the floor was hit, ball gets deleted if has hit the floor 3 times67 66 float gravityAcceleration_; 68 67 float speed_;
Note: See TracChangeset
for help on using the changeset viewer.