- Timestamp:
- Apr 27, 2017, 3:08:16 PM (9 years ago)
- Location:
- code/branches/SuperOrxoBros_FS17
- Files:
-
- 3 added
- 12 edited
-
data/levels/SOB.oxw (modified) (6 diffs)
-
data/overlays/SOBHUD.oxo (added)
-
src/modules/superorxobros/CMakeLists.txt (modified) (1 diff)
-
src/modules/superorxobros/Orxo.h (modified) (1 diff)
-
src/modules/superorxobros/SOB.cc (modified) (3 diffs)
-
src/modules/superorxobros/SOB.h (modified) (1 diff)
-
src/modules/superorxobros/SOBFigure.cc (modified) (7 diffs)
-
src/modules/superorxobros/SOBFigure.h (modified) (1 diff)
-
src/modules/superorxobros/SOBHUDInfo.cc (added)
-
src/modules/superorxobros/SOBHUDInfo.h (added)
-
src/modules/superorxobros/SOBMushroom.cc (modified) (1 diff)
-
src/modules/superorxobros/SOBMushroom.h (modified) (1 diff)
-
src/modules/superorxobros/SOBPrereqs.h (modified) (1 diff)
-
src/modules/superorxobros/SOBQBlock.cc (modified) (3 diffs)
-
src/modules/superorxobros/SOBQBlock.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw
r11404 r11405 11 11 include("stats.oxo") 12 12 include("templates/lodInformation.oxt") 13 include("overlays/SOBHUD.oxo") 13 14 ?> 15 16 17 <Template name=mushroom defaults=0> 18 <SOBMushroom collisionType="dynamic" speed=30> 19 <attached> 20 <Model mesh="QCube.mesh" position="0,0,20" scale=10/> 21 </attached> 22 <collisionShapes> 23 <BoxCollisionShape position="0,0,20" halfExtents="5,5,5" /><!-- 1 --> 24 </collisionShapes> 25 </SOBMushroom> 26 </Template> 27 28 14 29 15 30 <Template name=sobfigurecameras defaults=0> … … 118 133 119 134 120 <!-- BLOCK 1 in der LUFT - alle analog wie diesen :) -->121 <!-- Sobald ein QBlock von unten gehittet wird, wechselt die Visibility von allen attached Models. Hier wuerde also Cube1.1 invisible und Cube2.12 visible. Die Collisionshape wird ja sowieso beibehalten. -->122 <SOBQBlock collisionType="static" > <!-- 1 -->123 <attached> 124 <Model mesh="QCube.mesh" position="120,0,20"scale=10/>125 <Model mesh="Cube1.1.mesh" position=" 120,0,30" scale=10 visible="false"/>126 </attached> 127 <collisionShapes> 128 <BoxCollisionShape position=" 120,0,20" halfExtents="5,5,5" />135 <!-- BLOCK 1 in der LUFT - alle analog wie diesen :) --> 136 <!-- Sobald ein QBlock von unten gehittet wird, wechselt die Visibility von allen attached Models. Hier wuerde also Cube1.1 invisible und Cube2.12 visible. Die Collisionshape wird ja sowieso beibehalten. --> 137 <SOBQBlock collisionType="static" type="Mushroom" position="120,0,20"> <!-- 1 --> 138 <attached> 139 <Model mesh="QCube.mesh" scale=10/> 140 <Model mesh="Cube1.1.mesh" position="0,0,10" scale=10 visible="false"/> 141 </attached> 142 <collisionShapes> 143 <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" /> 129 144 </collisionShapes> 130 145 </SOBQBlock> … … 143 158 </SOBQBlock> 144 159 145 <SOBMushroom collisionType="dynamic" speed=30>160 <SOBMushroom collisionType="dynamic" speed=30> 146 161 <attached> 147 162 <Model mesh="QCube.mesh" position="0,0,20" scale=10/> … … 167 182 </SOBQBlock> 168 183 169 170 171 172 173 <SOBQBlock collisionType="static"><!-- ? Block -->184 185 186 187 188 <SOBQBlock collisionType="static"><!-- ? Block --> 174 189 <attached> 175 190 <Model mesh="QCube.mesh" position="190,0,20" scale=10/> <!-- 6 --> … … 256 271 257 272 258 273 259 274 <SOBQBlock collisionType="static"> <!-- 10er Block --> <!-- 2 --> 260 275 <attached> … … 356 371 357 372 <BoxCollisionShape position="720,0,20" halfExtents="5,5,5" /> <!-- 4 --> 358 373 359 374 360 375 <BoxCollisionShape position="890,0,20" halfExtents="5,5,5" /> <!-- 10 --> -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
r11402 r11405 7 7 SOBQBlock.cc 8 8 SOBMushroom.cc 9 SOBHUDInfo.cc 9 10 10 11 ) -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/Orxo.h
r11392 r11405 44 44 class Orxo : public SpaceShip 45 45 { 46 public:47 Orxo(Context* context);46 public: 47 Orxo(Context* context); 48 48 49 virtual void tick(float dt) override;49 virtual void tick(float dt) override; 50 50 51 51 52 52 // overwrite for 2d movement 53 virtual void moveFrontBack(const Vector2& value) override;54 virtual void moveRightLeft(const Vector2& value) override;53 virtual void moveFrontBack(const Vector2& value) override; 54 virtual void moveRightLeft(const Vector2& value) override; 55 55 56 56 // Starts or stops fireing 57 virtual void boost(bool bBoost) override;57 virtual void boost(bool bBoost) override; 58 58 59 59 //no rotation! 60 virtual void rotateYaw(const Vector2& value) override{};61 virtual void rotatePitch(const Vector2& value) override{};60 virtual void rotateYaw(const Vector2& value) override{}; 61 virtual void rotatePitch(const Vector2& value) override{}; 62 62 //return to main menu if game has ended. 63 virtual void rotateRoll(const Vector2& value) override;63 virtual void rotateRoll(const Vector2& value) override; 64 64 65 virtual void updateLevel();65 virtual void updateLevel(); 66 66 67 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;67 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 68 68 69 protected: 70 virtual void death() override; 71 private: 69 70 71 72 73 74 75 protected: 76 virtual void death() override; 77 private: 72 78 //SOB* getGame(); 73 79 //WeakPtr<SOB> game; 74 Camera* camera;75 float speed, damping, posforeward;76 float lastTimeFront, lastTimeLeft, lastTime;77 struct Velocity78 {79 float x;80 float y;81 } velocity, desiredVelocity;80 Camera* camera; 81 float speed, damping, posforeward; 82 float lastTimeFront, lastTimeLeft, lastTime; 83 struct Velocity 84 { 85 float x; 86 float y; 87 } velocity, desiredVelocity; 82 88 83 89 // WeakPtr<InvaderEnemy> lastEnemy; -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc
r11402 r11405 64 64 this->center_ = nullptr; 65 65 figure_ = nullptr; 66 setHUDTemplate("JumpHUD"); 66 setHUDTemplate("SOBHUD"); 67 coins_=0; 68 points_=0; 69 timeLeft_=400.0; 67 70 68 71 } … … 105 108 106 109 // Call start for the parent class. 107 Deathmatch::start();110 Gametype::start(); 108 111 109 112 if (figure_ != nullptr) … … 152 155 orxout() << "DEED" << endl; 153 156 157 158 timeLeft_-=dt*2.5; 154 159 } 155 160 -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
r11402 r11405 46 46 { 47 47 48 48 49 49 class _SOBExport SOB : public Deathmatch 50 50 { 51 public:51 public: 52 52 SOB(Context* context); //!< Constructor. Registers and initializes the object. 53 53 virtual ~SOB(); //!< Destructor. Cleans up, if initialized. 54 54 virtual void tick(float dt) override; 55 55 56 56 57 57 void setCenterpoint(SOBCenterpoint* center) 58 { this->center_ = center; }59 virtual void start() override;58 { this->center_ = center; } 59 virtual void start() override; 60 60 virtual void end() override; 61 61 virtual void spawnPlayer(PlayerInfo* player) override; 62 PlayerInfo* getPlayer() const;62 PlayerInfo* getPlayer() const; 63 63 64 65 64 int getPoints() { 65 return points_; 66 } 67 int getCoins() { 68 return coins_; 69 } 70 void addCoin() { 71 ++coins_; 72 points_+=200; 73 } 74 void addMushroom() { 75 points_+=1000; 76 } 77 int getTimeLeft() { 78 return timeLeft_; 79 } 80 81 82 virtual void playerEntered(PlayerInfo* player) override 83 { 84 Gametype::playerEntered(player); 85 } 86 87 88 WeakPtr<SOBCenterpoint> center_; 89 66 90 protected: 67 91 68 92 69 93 void cleanup(); //!< Cleans up the Gametype 70 WeakPtr<SOBCenterpoint> center_;71 94 WeakPtr<SOBFigure> figure_; 72 95 WeakPtr<Camera> camera; 73 74 75 }; 76 } 96 int points_; 97 int coins_; 98 float timeLeft_; 99 100 101 }; 102 } 77 103 78 104 #endif /* _Pong_H__ */ -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
r11402 r11405 41 41 42 42 #include "SOBMushroom.h" 43 #include "SOB.h" 43 44 44 45 namespace orxonox … … 66 67 67 68 dead_ = false; 69 gotPowerUp_ = false; 70 68 71 setAngularFactor(0.0); 69 this->enableCollisionCallback();72 this->enableCollisionCallback(); 70 73 } 71 74 … … 76 79 isColliding_ = true; 77 80 SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject); 78 if (mush != nullptr) { 79 orxout() << "YEPPIE" << endl; 80 //DESTROY THE OTHER OBJECT otherObject.destroyLater(); 81 } 82 83 return true; 81 // ADD ANOTHER OBJECT FOR BAD GUMBAS AND REMOVE POWERUP OR KILL PLAYER ON COLLISION WITHOUT Z-ACCELERATION 82 if (mush != nullptr && !(mush->hasCollided_)) { 83 otherObject->destroyLater(); 84 gotPowerUp_ = true; 85 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 86 SOBGame->addMushroom(); 87 mush->hasCollided_ = true; 88 89 } 90 91 return true; 84 92 } 85 93 … … 101 109 for (WorldEntity* object : this->getAttachedObjects()) 102 110 { 103 if (object->isA(Class(ParticleSpawner)))104 particlespawner_ = object;105 106 }107 108 }109 110 111 112 113 114 115 if (firePressed_ == false) {116 gravityAcceleration_ = 350.0;117 118 }119 120 if (hasLocalController())121 {122 Vector3 velocity = getVelocity();123 Vector3 position = getPosition();124 125 126 if (position.z < -100)127 dead_ = true;128 129 if (dead_) {130 velocity.x = 0;131 velocity.z = 0;132 setVelocity(velocity);133 return;134 }135 136 137 int maxvelocity_x = 100;138 int speedAddedPerTick = 5;139 int camMaxOffset = 25;140 141 timeSinceLastFire_ += dt;142 lastSpeed_z = velocity.z;111 if (object->isA(Class(ParticleSpawner))) 112 particlespawner_ = object; 113 114 } 115 116 } 117 118 119 120 121 122 123 if (firePressed_ == false) { 124 gravityAcceleration_ = 350.0; 125 126 } 127 128 if (hasLocalController()) 129 { 130 Vector3 velocity = getVelocity(); 131 Vector3 position = getPosition(); 132 133 134 if (position.z < -100) 135 dead_ = true; 136 137 if (dead_) { 138 velocity.x = 0; 139 velocity.z = 0; 140 setVelocity(velocity); 141 return; 142 } 143 144 145 int maxvelocity_x = 100; 146 int speedAddedPerTick = 5; 147 int camMaxOffset = 25; 148 149 timeSinceLastFire_ += dt; 150 lastSpeed_z = velocity.z; 143 151 144 152 145 153 146 154 //Handle the rocket fire from the jetpack 147 if (velocity.z > 40)148 particlespawner_->setVisible(true);149 else150 particlespawner_->setVisible(false);155 if (velocity.z > 40) 156 particlespawner_->setVisible(true); 157 else 158 particlespawner_->setVisible(false); 151 159 152 160 //If player hits space and does not move in z-dir 153 if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {154 gravityAcceleration_ = 100.0;161 if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) { 162 gravityAcceleration_ = 100.0; 155 163 velocity.z = 110; //150 156 164 } … … 163 171 if (moveRightPressed_) { 164 172 if (rot < 0.0) 165 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));173 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6)); 166 174 167 175 if (std::abs(velocity.x) < maxvelocity_x) { … … 178 186 } else if (moveLeftPressed_) { 179 187 if (rot >= 0.0) 180 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));188 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6)); 181 189 182 190 if (std::abs(velocity.x) < maxvelocity_x) { … … 200 208 cam->setPosition(campos); 201 209 } 202 if (campos.x - camMaxOffset > position.x) {210 if (campos.x - camMaxOffset > position.x) { 203 211 campos.x = position.x + camMaxOffset; 204 212 cam->setPosition(campos); -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h
r11400 r11405 61 61 private: 62 62 63 bool gotPowerUp_; 63 64 bool moveUpPressed_; 64 65 bool moveDownPressed_; -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc
r11402 r11405 54 54 gravityAcceleration_ = 350.0; 55 55 speed_ = 0.0; 56 hasCollided_=false; 56 57 57 58 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h
r11402 r11405 60 60 { return speed_; } 61 61 62 62 bool hasCollided_; 63 63 protected: 64 64 float gravityAcceleration_; -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
r11402 r11405 80 80 class SOBQBlock; 81 81 class SOBMushroom; 82 class SOBHUDInfo; 82 83 /* 83 84 class PongScore;*/ -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc
r11400 r11405 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/XMLPort.h" 38 #include "SOB.h" 39 #include "SOBMushroom.h" 37 40 38 41 namespace orxonox … … 62 65 if (!used_ && v_z > 50.0) { 63 66 used_ = true; 64 orxout() << "WDestrozed the block" << v_z << endl;65 67 66 for (WorldEntity* object : this->getAttachedObjects()) 67 { 68 69 70 object->setVisible(!object->isVisible()); 68 for (WorldEntity* object : this->getAttachedObjects()) 69 object->setVisible(!object->isVisible()); 70 71 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 72 if (type_ == "Coin") { 73 SOBGame->addCoin(); 71 74 } 72 73 75 if (type_ == "Mushroom") { 76 spawnMushroom(); 77 } 74 78 75 79 } … … 78 82 79 83 84 void SOBQBlock::XMLPort(Element& xmlelement, XMLPort::Mode mode) 85 { 86 SUPER(SOBQBlock, XMLPort, xmlelement, mode); 87 XMLPortParam(SOBQBlock, "type", setType, getType, xmlelement, mode).defaultValues(false); 88 89 90 } 91 92 93 void SOBQBlock::spawnMushroom() { 94 SOBCenterpoint* center_ = ((SOB*)getGametype())->center_; 95 96 SOBMushroom* mush = new SOBMushroom(center_->getContext()); 97 Vector3 spawnpos = this->getWorldPosition(); 98 spawnpos.z += 0; 99 100 if (mush != nullptr && center_ != nullptr) 101 { 102 mush->addTemplate("mushroom"); 103 104 105 106 //newBoots->addTemplate(center_->getBootsTemplate()); 107 mush->setPosition(spawnpos); 108 //newBoots->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity); 109 //newBoots->setFigure(figure_); 110 //center_->attach(newBoots); 111 } 112 } 113 114 80 115 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h
r11400 r11405 41 41 virtual ~SOBQBlock(); 42 42 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 43 44 45 void setType(std::string type) { 46 this->type_=type; 47 } 48 std::string getType() { 49 return this->type_; 50 } 44 51 protected: 45 52 bool used_; 53 std::string type_; 54 void spawnMushroom(); 46 55 }; 47 56
Note: See TracChangeset
for help on using the changeset viewer.










