Changeset 11416 for code/branches/SuperOrxoBros_FS17/src
- Timestamp:
- May 11, 2017, 3:18:27 PM (8 years ago)
- Location:
- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros
- Files:
-
- 4 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
r11412 r11416 10 10 SOBGumba.cc 11 11 SOBFlagstone.cc 12 SOBCastlestone.cc 13 SOBCoin.cc 12 14 13 15 ) -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ 28 28 29 29 /** 30 @file Pong.cc31 @brief Implementation of the Pongclass.30 @file SOB.cc 31 @brief Implementation of the SOB class. 32 32 */ 33 33 34 34 #include "SOB.h" 35 36 35 #include "core/CoreIncludes.h" 37 36 #include "core/EventIncludes.h" … … 39 38 #include "core/config/ConfigValueIncludes.h" 40 39 #include "core/Game.h" 41 42 40 #include "gamestates/GSLevel.h" 43 41 #include "chat/ChatManager.h" 44 42 #include "infos/PlayerInfo.h" 45 46 43 #include "SOBCenterpoint.h" 47 48 44 #include "SOBFigure.h" 49 45 #include "graphics/Camera.h" 46 47 50 48 51 49 namespace orxonox … … 89 87 } 90 88 89 90 91 91 void SOB::start() 92 92 { … … 95 95 if (figure_ == nullptr) 96 96 { 97 figure_ = new SOBFigure(center_->getContext()); 97 figure_ = new SOBFigure(center_->getContext()); //add a new instance of a player to the game 98 98 figure_->addTemplate(center_->getFigureTemplate()); 99 // figure_->InitializeAnimation(center_->getContext()); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@100 99 } 101 100 … … 124 123 cleanup(); 125 124 GSLevel::startMainMenu(); 126 127 125 Deathmatch::end(); 128 126 } … … 131 129 cleanup(); 132 130 133 // HACK 131 // HACK - only method I found to simply reload the level 134 132 Game::getInstance().popState(); 135 133 Game::getInstance().popState(); … … 144 142 if (figure_->getPlayer() == nullptr) 145 143 { 146 player->startControl(figure_); 144 player->startControl(figure_); //Give the control of the instance player to the real person 147 145 players_[player].state_ = PlayerState::Alive; 148 146 } … … 165 163 SUPER(SOB, tick, dt); 166 164 167 if (this->figure_ != nullptr && figure_->dead_) { 165 //If player has reached end of level 166 if (this->figure_ != nullptr && figure_->lvlEnded_) { 167 std::stringstream a; 168 a << "Nice! " << getPoints() << " Points. Press <Space> to restart"; 169 info_ =a.str(); 170 171 //If player has died 172 } else if (this->figure_ != nullptr && figure_->dead_) { 168 173 info_ = "Game over. Press <Space> to restart"; 169 orxout() << "DEED" << endl;170 174 } 171 175 172 176 177 //Kill the player if time is up 178 if (this->figure_ != nullptr && timeLeft_ <= 0) 179 this->figure_->dead_ = true; 180 //The time on the HUD 173 181 timeLeft_-=dt*2.5; 174 182 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ 28 28 29 29 /** 30 @file Pong.h 31 @brief Declaration of the Pong class. 32 @ingroup Pong 30 @file SOB.h 31 @brief Declaration of the SOB class. 33 32 */ 34 33 … … 37 36 38 37 #include "superorxobros/SOBPrereqs.h" 39 40 #include "tools/Timer.h"41 42 38 #include "gametypes/Deathmatch.h" 43 39 #include "SOBCenterpoint.h" … … 45 41 namespace orxonox 46 42 { 47 48 43 49 44 class _SOBExport SOB : public Deathmatch … … 63 58 64 59 void restart(); 60 61 //Functions for points and coins 65 62 int getPoints() { 66 63 return points_; … … 79 76 points_+=100; 80 77 } 78 void addPoints(int poi) { 79 points_+=poi; 80 } 81 81 int getTimeLeft() { 82 82 return timeLeft_; … … 86 86 } 87 87 88 89 90 //Not used yet - placed if somebody wants to develop lvl 1-2 etc 88 91 void setLvl(int lvl) { 89 92 lvl_ = lvl; … … 109 112 int coins_; 110 113 float timeLeft_; 111 114 112 115 int lvl_; 113 116 std::string info_; … … 117 120 } 118 121 119 #endif /* _ Pong_H__ */122 #endif /* _SOB_H__ */ -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.cc
r11381 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 29 29 /** 30 30 @file SOBCenterpoint.cc 31 @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the SOBCenterpoint.31 @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. 32 32 */ 33 33 … … 45 45 { 46 46 RegisterObject(SOBCenterpoint); 47 48 49 50 47 checkGametype(); 51 48 } … … 56 53 57 54 55 58 56 XMLPortParam(SOBCenterpoint, "cameraOffset", setCameraOffset, getCameraOffset, xmlelement, mode); 59 57 -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.h
r11392 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 38 38 /** 39 39 @brief 40 @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the SOBCenterpoint.40 @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. Everybody used it so I used it too, do not ask my why.. 41 41 */ 42 42 class _SOBExport SOBCenterpoint : public StaticEntity -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 44 44 #include "SOB.h" 45 45 #include "SOBFlagstone.h" 46 #include "SOBCastlestone.h" 46 47 47 48 namespace orxonox … … 54 55 55 56 // initialize variables 56 57 gravityAcceleration_ = 350.0; 58 59 //Vars for movement of player 57 60 moveUpPressed_ = false; 58 61 moveDownPressed_ = false; … … 60 63 moveDownPressed_ = false; 61 64 firePressed_ = false; 65 66 //Times and turning 62 67 timeSinceLastFire_ = 0.0; 63 68 lastSpeed_z = 0.0; 69 pitch_ = 0.0; 70 timeCounter_ = 0; 71 72 //Properties of player 73 gotPowerUp_ = false; 64 74 isColliding_ = true; 65 75 particlespawner_ = NULL; 66 76 67 gravityAcceleration_ = 350.0; 68 pitch_ = 0.0; 69 77 //Properties of players life 70 78 predead_ = false; 71 79 dead_ = false; 72 gotPowerUp_ = false; 80 lvlEnded_ = false; 81 reachedLvlEndState_ = 0; 82 73 83 74 setAngularFactor(0.0); 75 this->enableCollisionCallback(); 84 setAngularFactor(0.0); //Means player doesn't turn on collision, so he doesn't fall over while walking over the ground 85 this->enableCollisionCallback(); // Turns on that on every collision function collidesAgainst is executed 76 86 } 77 87 … … 81 91 82 92 isColliding_ = true; 93 94 //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr 83 95 SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject); 84 96 SOBGumba* gumba = orxonox_cast<SOBGumba*>(otherObject); 85 97 SOBFlagstone* flagstone = orxonox_cast<SOBFlagstone*>(otherObject); 86 98 SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*>(otherObject); 99 100 //Check if otherObject is a powerup 87 101 if (mush != nullptr && !(mush->hasCollided_)) { 88 102 otherObject->destroyLater(); 89 103 gotPowerUp_ = true; 90 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 91 SOBGame->addMushroom(); 92 mush->hasCollided_ = true; 93 104 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); //Get the Gametype 105 SOBGame->addMushroom(); // Tell the gametype to increase points 106 mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once 107 108 //Check if otherObject is a Gumba (that walking enemies) 94 109 } else if (gumba != nullptr && !(gumba->hasCollided_)) { 95 110 111 //If player jumps on its head, kill it, else, kill the player 96 112 if (getVelocity().z >= -20) { 97 113 Vector3 vel = getVelocity(); … … 100 116 setVelocity(vel); 101 117 predead_=true; 118 102 119 } else { 103 120 gumba->destroyLater(); … … 110 127 } 111 128 112 if (flagstone != nullptr && !(flagstone->hasCollided_)) { 113 flagstone->hasCollided_ = true; 114 115 } 129 //Purpose is that if player hits the flag, he should walk into the castle at the end of the level. For that we use SOBCastlestone 130 if (reachedLvlEndState_ == 0 && flagstone != nullptr && !(flagstone->hasCollided_)) { 131 flagstone->hasCollided_ = true; 132 reachedLvlEndState_ = 1; 133 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 134 SOBGame->addPoints(flagstone->getPoints()); 135 136 } 137 if (castlestone != nullptr && !(castlestone->hasCollided_)) { 138 castlestone->hasCollided_ = true; 139 reachedLvlEndState_++; 140 141 } 116 142 117 143 return true; … … 119 145 120 146 121 122 void SOBFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode) 123 { 124 SUPER(SOBFigure, XMLPort, xmlelement, mode); 125 126 } 127 128 147 //Self implemented sign function that returns either 1 or -1 (and never 0) 129 148 int SOBFigure::sgn(float x) { 130 131 149 if (x < 0.0) return -1; 132 150 return 1; 133 151 } 134 152 153 //For those of you who don't have an idea: the tick function is called about 50 times/sec 135 154 void SOBFigure::tick(float dt) 136 155 { 137 156 SUPER(SOBFigure, tick, dt); 138 157 158 159 bool inputAllowed = true; 160 161 //the particle spawner that generates the fire from the backpack when pressed 139 162 if (particlespawner_ == NULL) { 140 163 for (WorldEntity* object : this->getAttachedObjects()) 141 164 { 142 if (object->isA(Class(ParticleSpawner)))165 if (object->isA(Class(ParticleSpawner))) 143 166 particlespawner_ = object; 144 145 } 146 147 } 148 149 150 151 152 153 154 if (firePressed_ == false) { 155 gravityAcceleration_ = 350.0; 156 157 } 158 159 if (hasLocalController()) 160 { 161 Vector3 velocity = getVelocity(); 162 Vector3 position = getPosition(); 163 164 if (!predead_) 165 velocity.y = 0; 166 if (position.z < -100) { 167 dead_ = true; 168 169 } 170 171 if (dead_) { 172 velocity.x = 0; 173 velocity.z = 0; 174 setVelocity(velocity); 175 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 176 if (firePressed_) 177 SOBGame->restart(); 178 return; 179 } 180 181 182 int maxvelocity_x = 100; 183 int speedAddedPerTick = 5; 184 int camMaxOffset = 25; 185 186 timeSinceLastFire_ += dt; 187 lastSpeed_z = velocity.z; 167 } 168 } 169 170 171 //Behavior on level end - this is like described above for the movement from the player when hit the flag. He moves then into the castle 172 if (reachedLvlEndState_ != 0) { 173 timeCounter_+= dt; 174 inputAllowed = false; 175 } 176 if (reachedLvlEndState_ == 1 && timeCounter_ >= 1.5) { 177 timeCounter_ = 0; 178 reachedLvlEndState_ = 2; 179 } 180 181 182 //if input blocked, then cancel every movement operation 183 if (!inputAllowed) { 184 moveUpPressed_ = false; 185 moveDownPressed_ = false; 186 moveLeftPressed_ = false; 187 moveRightPressed_ = false; 188 } 189 190 //set the gravityto standard 350 191 if (firePressed_ == false) { 192 gravityAcceleration_ = 350.0; 193 194 } 195 196 if (hasLocalController()) 197 { 198 Vector3 velocity = getVelocity(); 199 Vector3 position = getPosition(); 200 201 if (!predead_) 202 velocity.y = 0; 203 if (position.z < -100) { 204 dead_ = true; 205 } 206 207 208 if (dead_) { 209 velocity.x = 0; 210 velocity.z = 0; 211 setVelocity(velocity); 212 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 213 if (firePressed_) 214 SOBGame->restart(); 215 return; 216 } 217 218 219 int maxvelocity_x = 100; 220 int speedAddedPerTick = 5; 221 int camMaxOffset = 25; 222 223 timeSinceLastFire_ += dt; 224 lastSpeed_z = velocity.z; 188 225 189 226 190 227 191 228 //Handle the rocket fire from the jetpack 192 if (velocity.z > 40) 193 particlespawner_->setVisible(true); 194 else 195 particlespawner_->setVisible(false); 229 if (velocity.z > 40) 230 particlespawner_->setVisible(true); 231 else 232 particlespawner_->setVisible(false); 233 196 234 197 235 //If player hits space and does not move in z-dir 198 if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {199 gravityAcceleration_ = 100.0;236 if (inputAllowed && firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) { 237 gravityAcceleration_ = 100.0; 200 238 velocity.z = 110; //150 201 239 } 202 203 // rotate(1,getOrientation()* WorldEntity::FRONT)204 240 205 241 206 242 //Left-right movement with acceleration 207 243 float rot = getOrientation().getRoll().valueDegrees(); 208 orxout() << rot << endl;209 244 if (moveRightPressed_) { 210 245 if (!(rot < 5.0 && -5.0 < rot)) 211 246 setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() - sgn(rot)*dt*Radian(6)); 212 213 247 214 248 if (std::abs(velocity.x) < maxvelocity_x) { … … 230 264 231 265 266 //Again another EndOfLevel behavior 267 if (reachedLvlEndState_ == 1) 268 velocity.x = -2; 269 if (reachedLvlEndState_ == 2) 270 velocity.x = 30; 271 if (reachedLvlEndState_ == 3) { 272 velocity.x = 0; 273 velocity.y = 20; 274 } 275 if (reachedLvlEndState_ == 4) { 276 lvlEnded_ = true; 277 dead_ = true; 278 } 279 280 //velocity = acc. * time 232 281 velocity.z -= gravityAcceleration_*dt; 233 282 setVelocity(velocity); 234 283 235 284 236 //Camera operation 285 //Camera operation - the camera should always follow the player in a specific region 237 286 Camera* cam = getCamera(); 238 287 Vector3 campos = cam->getPosition(); … … 252 301 } 253 302 254 // Move through the left and right screen boundaries 255 256 //setPosition(position); 257 258 // Reset key variables 303 304 305 // Reset key variables 259 306 moveUpPressed_ = false; 260 307 moveDownPressed_ = false; 261 308 moveLeftPressed_ = false; 262 309 moveRightPressed_ = false; 263 moveDownPressed_ = false; 310 264 311 isColliding_ = false; 265 312 … … 270 317 271 318 272 319 //The following functions read the input of the player and then set the bools for the movement 273 320 void SOBFigure::moveFrontBack(const Vector2& value) 274 321 { … … 299 346 } 300 347 301 302 303 304 305 348 void SOBFigure::boost(bool boost) 306 349 { 307 350 firePressed_ = boost; 308 351 } 309 } 352 353 354 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 41 41 SOBFigure(Context* context); //!< Constructor. Registers and initializes the object. 42 42 virtual ~SOBFigure() {} 43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;44 43 virtual void tick(float dt) override; 45 44 virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the figure up and down. 46 45 virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the figure up and down. 47 48 49 46 virtual void boost(bool boost) override; 50 47 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 51 48 52 53 //virtual void CollisionWithEnemy(SOBEnemy* enemy);54 55 56 57 58 49 bool dead_; 59 50 bool predead_; 51 bool lvlEnded_; 60 52 61 53 private: 62 54 55 //Soooo many declarations 63 56 bool gotPowerUp_; 64 57 bool moveUpPressed_; … … 75 68 WorldEntity* particlespawner_; 76 69 int sgn(float x); 70 int reachedLvlEndState_; 71 float timeCounter_; 77 72 78 73 -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.cc
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 29 29 /** 30 30 @file SOBFlagstone.cc 31 @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.31 @brief The flagstone, as described in the h file 32 32 */ 33 33 … … 44 44 RegisterClass(SOBFlagstone); 45 45 46 SOBFlagstone::SOBFlagstone(Context* context) : MovableEntity(context)46 SOBFlagstone::SOBFlagstone(Context* context) : StaticEntity(context) 47 47 { 48 48 RegisterObject(SOBFlagstone); … … 50 50 setAngularFactor(0.0); 51 51 this->enableCollisionCallback(); 52 52 53 53 hasCollided_=false; 54 54 55 55 56 56 } 57 57 … … 64 64 65 65 66 66 } 67 67 68 68 69 69 bool SOBFlagstone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 70 70 71 72 73 orxout() << "Watshc bum baem" << otherObject->getMass()<< endl; 74 return true; 71 return true; 75 72 } 76 73 77 74 78 75 79 76 80 77 81 78 82 79 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.h
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 29 29 /** 30 30 @file SOBFlagstone.h 31 @brief Declaration of the SOBFlagstone class. 31 @brief Declaration of the SOBFlagstone class. This class is used for the flag - for everz 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get. 32 32 @ingroup SOB 33 33 */ … … 37 37 38 38 #include "superorxobros/SOBPrereqs.h" 39 #include "worldentities/ MovableEntity.h"39 #include "worldentities/StaticEntity.h" 40 40 41 41 42 42 namespace orxonox 43 43 { 44 class _SOBExport SOBFlagstone : public MovableEntity44 class _SOBExport SOBFlagstone : public StaticEntity 45 45 { 46 46 public: -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.cc
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 76 76 bool SOBGumba::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 77 77 78 78 //Every object with mass -1 does not change the direction of the Gumba. For example the ground floor! The other objects switch the direction of the gumba. 79 79 if (changeAllowed_ && otherObject->getMass() != -1) { 80 80 goesRight_ = !goesRight_; … … 91 91 } 92 92 93 void SOBGumba::touchFigure()94 {95 93 96 }97 94 98 95 void SOBGumba::tick(float dt) … … 102 99 if (!changeAllowed_) { 103 100 changedOn_+= dt; 104 if (changedOn_> 200) { 101 // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions! 102 if (changedOn_> 0.200) { 105 103 changeAllowed_ = true; 106 104 changedOn_ = 0.0; … … 119 117 setVelocity(velocity); 120 118 121 122 123 119 lastPos_ = getPosition(); 124 120 } … … 126 122 127 123 } 128 /*129 * ORXONOX - the hottest 3D action shooter ever to exist130 * > www.orxonox.net <131 *132 *133 * License notice:134 *135 * This program is free software; you can redistribute it and/or136 * modify it under the terms of the GNU General Public License137 * as published by the Free Software Foundation; either version 2138 * of the License, or (at your option) any later version.139 *140 * This program is distributed in the hope that it will be useful,141 * but WITHOUT ANY WARRANTY; without even the implied warranty of142 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the143 * GNU General Public License for more details.144 *145 * You should have received a copy of the GNU General Public License146 * along with this program; if not, write to the Free Software147 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.148 *149 * Author:150 * Fabien Vultier151 * Co-authors:152 * ...153 *154 */155 156 /**157 @file SOBGumba.h158 @brief Declaration of the SOBGumba class.159 @ingroup SOB160 */161 162 #ifndef _SOBGumba_H__163 #define _SOBGumba_H__164 165 #include "superorxobros/SOBPrereqs.h"166 #include "worldentities/MovableEntity.h"167 168 169 namespace orxonox170 {171 class _SOBExport SOBGumba : public MovableEntity172 {173 public:174 SOBGumba(Context* context);175 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;176 virtual void setFigure(SOBFigure* newFigure);177 virtual void touchFigure();178 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;179 virtual void tick(float dt) override;180 181 182 bool attachedToFigure_;183 184 void setSpeed(const float speed)185 { this->speed_ = speed; }186 float getSpeed() const187 { return speed_; }188 189 bool hasCollided_;190 protected:191 float gravityAcceleration_;192 float speed_;193 WeakPtr<SOBFigure> figure_;194 bool goesRight_;195 Vector3 lastPos_;196 bool changeAllowed_;197 float changedOn_;198 199 };200 }201 202 #endif /* _SOBGumba_H__ */ -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.h
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 29 29 /** 30 30 @file SOBGumba.h 31 @brief Declaration of the SOBGumba class. 31 @brief Declaration of the SOBGumba class. Gumbas are the enemie mushrooms - pretty sure it's written Goomba but, naaah 32 32 @ingroup SOB 33 33 */ … … 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 49 virtual void setFigure(SOBFigure* newFigure); 50 virtual void touchFigure();51 50 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 52 51 virtual void tick(float dt) override; -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc
r11412 r11416 21 21 * 22 22 * Author: 23 * Florian Zinggeler23 * Julien Kindle 24 24 * 25 25 */ … … 60 60 SUPER(SOBHUDInfo, tick, dt); 61 61 62 //If you have a look at the HUD xml file, you can see there are several elements with different types. 62 63 if (this->SOBGame) 63 64 { 64 65 65 // setPosition(Vector2(0.1, 0.65)); 66 if (this->type_ == "Coins") { 67 // this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!"); 68 66 if (this->type_ == "Coins") { 69 67 70 68 std::stringstream ss; … … 99 97 } 100 98 99 //No idea why, just implement this method 101 100 void SOBHUDInfo::changedOwner() 102 101 { -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h
r11405 r11416 21 21 * 22 22 * Author: 23 * Florian Zinggeler23 * Julien Kindle 24 24 * 25 25 */ -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc
r11400 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 29 29 /** 30 30 @file SOBItem.cc 31 @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.31 @brief Not sure if ever used 32 32 */ 33 33 … … 67 67 bool SOBItem::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 68 68 69 //orxout() << "Watshc bum baem" << endl; 70 return true; 69 return true; 71 70 } 72 71 … … 77 76 } 78 77 79 void SOBItem::touchFigure()80 {81 78 82 }83 79 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h
r11400 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 49 virtual void setFigure(SOBFigure* newFigure); 50 virtual void touchFigure();51 50 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 52 51 -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc
r11412 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 29 29 /** 30 30 @file SOBMushroom.cc 31 @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.31 @brief This is the class for the powerup mushroom 32 32 */ 33 33 … … 77 77 78 78 79 if (changeAllowed_ && otherObject->getMass() != -1) {79 if (changeAllowed_ && otherObject->getMass() != -1) { 80 80 goesRight_ = !goesRight_; 81 81 changeAllowed_ = false; 82 }82 } 83 83 84 orxout() << "Watshc bum baem" << otherObject->getMass()<< endl; 85 return true; 84 return true; 86 85 } 87 86 … … 92 91 } 93 92 94 void SOBMushroom::touchFigure()95 {96 93 97 }98 94 99 95 void SOBMushroom::tick(float dt) … … 101 97 SUPER(SOBMushroom, tick, dt); 102 98 99 //Exactly like the Gumba class, if collided, turn direction of Mushroom and wait 200ms so we don't get two collisions from the same wall 103 100 if (!changeAllowed_) { 104 101 changedOn_+= dt; 105 if (changedOn_> 200) {102 if (changedOn_> 0.200) { 106 103 changeAllowed_ = true; 107 104 changedOn_ = 0.0; -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h
r11412 r11416 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 49 virtual void setFigure(SOBFigure* newFigure); 50 virtual void touchFigure();51 50 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 52 51 virtual void tick(float dt) override; -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
r11412 r11416 21 21 * 22 22 * Author: 23 * Reto Grieder23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 30 30 @file 31 31 @brief 32 Shared library macros, enums, constants and forward declarations for the pongmodule32 Shared library macros, enums, constants and forward declarations for the SOB module 33 33 */ 34 34 … … 68 68 namespace orxonox 69 69 { 70 /* class Pong;71 class PongAI;72 class PongBall;73 class PongBat;74 class PongBot;*/75 70 class SOBCenterpoint; 76 77 71 class SOB; 78 72 class SOBFigure; … … 83 77 class SOBGumba; 84 78 class SOBFlagstone; 85 /* 86 class PongScore;*/ 79 class SOBCastlestone; 80 class SOBCoin; 81 87 82 } 88 83 -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc
r11405 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 38 38 #include "SOB.h" 39 39 #include "SOBMushroom.h" 40 #include "SOBCoin.h" 40 41 41 42 namespace orxonox … … 47 48 RegisterObject(SOBQBlock); 48 49 used_ = false; 49 50 // setPosition(Vector3(0,0,0)); 51 // setVelocity(Vector3(0,0,0)); 52 // setAcceleration(Vector3(0,0,0)); 53 // setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 50 54 51 } 55 52 … … 62 59 bool SOBQBlock::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 63 60 61 62 //If you hit the QBlock, the visibility of all attached objects get inverted! Pretty easy way to create changing blocks :) 64 63 float v_z = otherObject->getVelocity().z; 65 64 if (!used_ && v_z > 50.0) { … … 70 69 71 70 SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); 71 72 //Spawn either a powerup mushroom or a coin animation (also just an object, have a look at the SOBCoin class) 73 //The spawn methods are declared at the bottom of this file 72 74 if (type_ == "Coin") { 73 75 SOBGame->addCoin(); 76 spawnCoin(); 74 77 } 75 78 if (type_ == "Mushroom") { … … 91 94 92 95 96 //The spawnmethods from above 93 97 void SOBQBlock::spawnMushroom() { 94 98 SOBCenterpoint* center_ = ((SOB*)getGametype())->center_; … … 101 105 { 102 106 mush->addTemplate("mushroom"); 103 107 mush->setPosition(spawnpos); 108 109 } 110 } 104 111 112 void SOBQBlock::spawnCoin() { 113 SOBCenterpoint* center_ = ((SOB*)getGametype())->center_; 105 114 106 //newBoots->addTemplate(center_->getBootsTemplate()); 115 SOBCoin* mush = new SOBCoin(center_->getContext()); 116 Vector3 spawnpos = this->getWorldPosition(); 117 spawnpos.z += 0; 118 119 if (mush != nullptr && center_ != nullptr) 120 { 121 mush->addTemplate("coin"); 107 122 mush->setPosition(spawnpos); 108 //newBoots->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity); 109 //newBoots->setFigure(figure_); 110 //center_->attach(newBoots); 123 111 124 } 112 125 } -
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h
r11405 r11416 21 21 * 22 22 * Author: 23 * Fabien Vultier23 * Julien Kindle 24 24 * Co-authors: 25 * ...25 * 26 26 * 27 27 */ … … 53 53 std::string type_; 54 54 void spawnMushroom(); 55 void spawnCoin(); 55 56 }; 56 57
Note: See TracChangeset
for help on using the changeset viewer.