Changeset 11573 for code/branches/SOBv2_HS17
- Timestamp:
- Nov 20, 2017, 3:11:07 PM (7 years ago)
- Location:
- code/branches/SOBv2_HS17
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SOBv2_HS17/data/levels/SOB.oxw
r11569 r11573 64 64 </Template> 65 65 66 67 66 <!--Test Fireball--> 67 68 69 <Template name=fireball> 70 <SOBFireball collisionType="dynamic" speed=80> 71 <attached> 72 <Model mesh="planets/sol.mesh" position="0,0,0" scale=3 pitch=90/> 73 74 </attached> 75 <collisionShapes> 76 <SphereCollisionShape position="0,0,0" halfExtents="5,5,5" /> 77 </collisionShapes> 78 </SOBFireball> 79 </Template> 68 80 69 81 … … 99 111 </MovableEntity> 100 112 101 <!--Test Fireball-->102 103 104 105 <SOBFireball collisionType="dynamic" speed=80 position = "10,0,40">106 <attached>107 <Model mesh="planets/sol.mesh" position="0,0,0" scale=3 pitch=90/>108 109 </attached>110 <collisionShapes>111 <SphereCollisionShape position="0,0,0" halfExtents="5,5,5" />112 </collisionShapes>113 </SOBFireball>114 113 115 114 -
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.