- Timestamp:
- Nov 20, 2017, 3:11:07 PM (7 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.