- Timestamp:
- Apr 13, 2017, 3:30:24 PM (8 years ago)
- Location:
- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
r11392 r11400 5 5 SOBFigure.cc 6 6 SOBItem.cc 7 7 SOBQBlock.cc 8 8 9 9 ) -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
r11392 r11400 38 38 #include "graphics/Model.h" 39 39 #include "graphics/Camera.h" 40 #include "graphics/ParticleSpawner.h" 41 40 42 41 43 namespace orxonox … … 56 58 timeSinceLastFire_ = 0.0; 57 59 lastSpeed_z = 0.0; 58 59 gravityAcceleration_ = 250.0; 60 isColliding_ = true; 61 particlespawner_ = NULL; 62 63 gravityAcceleration_ = 350.0; 60 64 pitch_ = 0.0; 61 65 62 66 dead_ = false; 63 67 setAngularFactor(0.0); 64 } 68 this->enableCollisionCallback(); 69 } 70 71 72 73 bool SOBFigure::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 74 75 isColliding_ = true; 76 77 78 return true; 79 } 80 81 65 82 66 83 void SOBFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode) … … 70 87 } 71 88 89 90 72 91 void SOBFigure::tick(float dt) 73 92 { 74 93 SUPER(SOBFigure, tick, dt); 94 95 if (particlespawner_ == NULL) { 96 for (WorldEntity* object : this->getAttachedObjects()) 97 { 98 if (object->isA(Class(ParticleSpawner))) 99 particlespawner_ = object; 100 101 } 102 103 } 104 105 106 107 108 109 if (firePressed_ == false) { 110 gravityAcceleration_ = 350.0; 111 112 } 75 113 76 114 if (hasLocalController()) … … 96 134 97 135 136 //Handle the rocket fire from the jetpack 137 if (velocity.z > 40) 138 particlespawner_->setVisible(true); 139 else 140 particlespawner_->setVisible(false); 141 98 142 //If player hits space and does not move in z-dir 99 if (firePressed_ && std::abs(velocity.z) < 0.07 && std::abs(lastSpeed_z) < 0.07) { 100 velocity.z = 150; 143 if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) { 144 gravityAcceleration_ = 100.0; 145 velocity.z = 110; //150 101 146 } 102 147 103 148 // rotate(1,getOrientation()* WorldEntity::FRONT) 104 149 150 105 151 //Left-right movement with acceleration 152 float rot = getOrientation().getRoll().valueDegrees(); 106 153 if (moveRightPressed_) { 154 if (rot < 0.0) 155 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6)); 156 107 157 if (std::abs(velocity.x) < maxvelocity_x) { 108 158 velocity.x += speedAddedPerTick; 159 160 161 162 163 109 164 // if (pitch_ > 0.0) { 110 165 // pitch -= turn_fac*dt); … … 112 167 } 113 168 } else if (moveLeftPressed_) { 169 if (rot >= 0.0) 170 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6)); 171 114 172 if (std::abs(velocity.x) < maxvelocity_x) { 115 173 velocity.x -= speedAddedPerTick; … … 152 210 moveRightPressed_ = false; 153 211 moveDownPressed_ = false; 154 firePressed_ = false;212 isColliding_ = false; 155 213 156 214 } … … 195 253 void SOBFigure::boost(bool boost) 196 254 { 197 firePressed_ = true;198 } 199 } 255 firePressed_ = boost; 256 } 257 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h
r11392 r11400 33 33 #include "worldentities/ControllableEntity.h" 34 34 35 35 36 namespace orxonox 36 37 { … … 47 48 48 49 virtual void boost(bool boost) override; 49 50 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 51 50 52 51 53 //virtual void CollisionWithEnemy(SOBEnemy* enemy); … … 69 71 SOBCenterpoint* sobcenterpoint; 70 72 float pitch_; 73 bool isColliding_; 74 WorldEntity* particlespawner_; 71 75 72 76 -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc
r11392 r11400 67 67 bool SOBItem::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 68 68 69 orxout() << "Watshc bum baem" << endl;69 //orxout() << "Watshc bum baem" << endl; 70 70 return true; 71 71 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h
r11392 r11400 50 50 virtual void touchFigure(); 51 51 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 52 52 53 53 54 54 bool attachedToFigure_; -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
r11392 r11400 78 78 class SOBFigure; 79 79 class SOBItem; 80 class SOBQBlock; 80 81 /* 81 82 class PongScore;*/
Note: See TracChangeset
for help on using the changeset viewer.