Changeset 11769
- Timestamp:
- Feb 18, 2018, 5:23:29 PM (7 years ago)
- Location:
- code/branches/Presentation_HS17_merge/src/modules/superorxobros
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.cc
r11766 r11769 60 60 { 61 61 RegisterObject(SOB); 62 camera = nullptr;63 62 64 63 this->center_ = nullptr; … … 69 68 timeLeft_=400.0; 70 69 done_ = true; 70 newHighscore = false; 71 71 lvl_ = 1; 72 72 … … 79 79 SOB::~SOB() 80 80 { 81 if (this->isInitialized())82 this->cleanup();83 81 } 84 85 void SOB::cleanup()86 {87 camera = nullptr;88 }89 90 91 82 92 83 void SOB::start() … … 113 104 Gametype::start(); 114 105 115 if (figure_ != nullptr)116 {117 camera = figure_->getCamera();118 }119 120 106 } 121 107 122 108 void SOB::end() 123 109 { 124 cleanup();125 110 GSLevel::startMainMenu(); 126 111 Deathmatch::end(); … … 128 113 129 114 void SOB::restart() { 130 cleanup();131 132 115 // HACK - only method I found to simply reload the level 133 116 Game::getInstance().popState(); -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOB.h
r11766 r11769 111 111 112 112 113 void cleanup(); //!< Cleans up the Gametype114 113 WeakPtr<SOBFigure> figure_; 115 WeakPtr<Camera> camera;116 114 int points_; 117 115 int coins_; -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBCoin.cc
r11420 r11769 49 49 setAngularFactor(0.0); 50 50 51 speed_ = 0; 52 lifetime_ = 0; 51 53 } 52 54 … … 67 69 lifetime_-=dt; 68 70 69 if (lifetime_ < +0) {71 if (lifetime_ < 0) { 70 72 destroyLater(); 71 73 } -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBCoin.h
r11416 r11769 50 50 51 51 52 bool attachedToFigure_;53 54 52 void setLifetime(const float lt) 55 53 { this->lifetime_ = lt; } -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.cc
r11768 r11769 69 69 moveDownPressed_ = false; 70 70 moveLeftPressed_ = false; 71 move DownPressed_ = false;71 moveRightPressed_ = false; 72 72 firePressed_ = false; 73 73 collDisZ_ = 0; … … 76 76 timeSinceLastFire_ = 0.0; 77 77 lastSpeed_z = 0.0; 78 pitch_ = 0.0;79 78 timeCounter_ = 0; 80 79 -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFigure.h
r11766 r11769 68 68 float lastSpeed_z; 69 69 float firecooldown_; 70 SOBCenterpoint* sobcenterpoint;71 float pitch_;72 70 bool isColliding_; 73 71 WorldEntity* particlespawner_; -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.cc
r11766 r11769 56 56 RegisterObject(SOBFireball); 57 57 58 attachedToFigure_ = false;59 58 setAngularFactor(0.0); 60 figure_ = nullptr;61 59 this->enableCollisionCallback(); 62 60 gravityAcceleration_ = 350.0; … … 64 62 speed_ = 0; 65 63 hasCollided_=false; 66 lastPos_ = getPosition();67 lastPos_.x -= 20;68 64 changeAllowed_ = true; 69 65 changedOn_ = 0.0; 70 66 goesRight_ = true; 71 collDisX_ = 0;72 collDisZ_ = 0;73 67 hitCounter_ = 0; 74 68 particlespawner_ = NULL ; … … 104 98 105 99 bool SOBFireball::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) { 106 collDisX_ = getPosition().x - contactPoint.getPositionWorldOnB().getX();107 collDisZ_ = getPosition().z - contactPoint.getPositionWorldOnB().getZ();100 float collDisX_ = getPosition().x - contactPoint.getPositionWorldOnB().getX(); 101 float collDisZ_ = getPosition().z - contactPoint.getPositionWorldOnB().getZ(); 108 102 109 103 SOBGumba* gumba = orxonox_cast<SOBGumba*> (otherObject); … … 148 142 hitCounter_++; 149 143 150 collDisZ_=0;151 collDisX_=0;152 153 144 return true; 154 145 } 155 156 157 void SOBFireball::setFigure(SOBFigure* newFigure)158 {159 figure_ = newFigure;160 }161 162 146 163 147 … … 199 183 setVelocity(velocity); 200 184 201 lastPos_ = getPosition();202 203 185 if(abs(this->getPosition().z) > 1000) delete this; 204 186 -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFireball.h
r11766 r11769 50 50 51 51 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 52 virtual void setFigure(SOBFigure* newFigure);53 52 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 54 53 virtual void tick(float dt) override; 55 54 void setDirection(const bool direction); 56 55 57 bool attachedToFigure_;58 59 56 void setSpeed(const float speed) 60 57 { this->speed_ = speed; } … … 66 63 float gravityAcceleration_; 67 64 float speed_; 68 WeakPtr<SOBFigure> figure_;69 Vector3 lastPos_;70 65 bool goesRight_; 71 66 bool changeAllowed_; … … 73 68 int hitCounter_; 74 69 WorldEntity* particlespawner_; 75 76 77 78 79 float collDisX_;80 float collDisZ_;81 70 82 71 }; -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBFlagstone.cc
r11416 r11769 52 52 53 53 hasCollided_=false; 54 54 points_=0; 55 55 56 56 } -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.cc
r11766 r11769 48 48 RegisterObject(SOBGumba); 49 49 50 attachedToFigure_ = false;51 50 setAngularFactor(0.0); 52 figure_ = nullptr;53 51 this->enableCollisionCallback(); 54 52 gravityAcceleration_ = 350.0; … … 56 54 hasCollided_=false; 57 55 goesRight_ = true; 58 lastPos_ = getPosition();59 lastPos_.x -= 20;60 56 changeAllowed_ = true; 61 57 changedOn_ = 0.0; … … 88 84 } 89 85 90 91 void SOBGumba::setFigure(SOBFigure* newFigure)92 {93 figure_ = newFigure;94 }95 86 96 87 void SOBGumba::setDirection(const bool direction) … … 140 131 setVelocity(velocity); 141 132 142 lastPos_ = getPosition();143 144 133 if (creator_ != nullptr) 145 134 { -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumba.h
r11766 r11769 47 47 SOBGumba(Context* context); 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 virtual void setFigure(SOBFigure* newFigure);50 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 51 50 virtual void tick(float dt) override; … … 54 53 void die(); 55 54 56 bool attachedToFigure_;57 58 55 void setSpeed(const float speed) 59 56 { this->speed_ = speed; } … … 66 63 float gravityAcceleration_; 67 64 float speed_; 68 WeakPtr<SOBFigure> figure_;69 65 bool goesRight_; 70 Vector3 lastPos_;71 66 bool changeAllowed_; 72 67 float changedOn_; -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBGumbaBoss.cc
r11766 r11769 152 152 setVelocity(velocity); 153 153 154 lastPos_ = getPosition();155 156 154 } 157 155 -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBMushroom.cc
r11416 r11769 48 48 RegisterObject(SOBMushroom); 49 49 50 attachedToFigure_ = false;51 50 setAngularFactor(0.0); 52 figure_ = nullptr;53 51 this->enableCollisionCallback(); 54 52 gravityAcceleration_ = 350.0; … … 56 54 hasCollided_=false; 57 55 goesRight_ = true; 58 lastPos_ = getPosition();59 lastPos_.x -= 20;60 56 changeAllowed_ = true; 61 57 changedOn_ = 0.0; … … 86 82 87 83 88 void SOBMushroom::setFigure(SOBFigure* newFigure)89 {90 figure_ = newFigure;91 }92 93 94 95 84 void SOBMushroom::tick(float dt) 96 85 { … … 104 93 changedOn_ = 0.0; 105 94 95 } 106 96 } 107 }108 97 109 98 … … 116 105 velocity.x = dir*speed_; 117 106 setVelocity(velocity); 118 119 120 121 lastPos_ = getPosition(); 122 } 107 } 123 108 124 109 -
code/branches/Presentation_HS17_merge/src/modules/superorxobros/SOBMushroom.h
r11416 r11769 47 47 SOBMushroom(Context* context); 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 virtual void setFigure(SOBFigure* newFigure);50 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 51 50 virtual void tick(float dt) override; 52 51 53 52 54 bool attachedToFigure_;55 56 53 void setSpeed(const float speed) 57 54 { this->speed_ = speed; } … … 63 60 float gravityAcceleration_; 64 61 float speed_; 65 WeakPtr<SOBFigure> figure_;66 62 bool goesRight_; 67 Vector3 lastPos_;68 63 bool changeAllowed_; 69 64 float changedOn_;
Note: See TracChangeset
for help on using the changeset viewer.