Changeset 12371 for code/branches/OrxoBlox_FS19/src
- Timestamp:
- May 16, 2019, 1:13:58 PM (6 years ago)
- Location:
- code/branches/OrxoBlox_FS19/src/modules
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt
r12367 r12371 3 3 OrxoBlox.cc 4 4 OrxoBloxWall.cc 5 OrxoBloxBall.cc6 5 OrxoBloxCenterpoint.cc 7 6 OrxoBloxStones.cc -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
r12370 r12371 48 48 49 49 #include "OrxoBloxCenterpoint.h" 50 #include "OrxoBloxBall.h"51 50 #include "OrxoBloxStones.h" 52 51 #include "OrxoBloxWall.h" … … 68 67 69 68 this->center_ = nullptr; 70 this->ball_ = nullptr;69 //this->ball_ = nullptr; 71 70 this->futureWall_ = nullptr; 72 71 this->player_ = nullptr; … … 77 76 78 77 // Pre-set the timer, but don't start it yet. 79 this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&OrxoBlox:: startBall, this)));78 this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&OrxoBlox::LevelUp, this))); 80 79 this->starttimer_.stopTimer(); 81 80 … … 100 99 void OrxoBlox::cleanup() 101 100 { 102 if (this->ball_ != nullptr) // Destroy the ball, if present.103 {104 this->ball_->destroy();105 this->ball_ = nullptr;106 }101 //if (this->ball_ != nullptr) // Destroy the ball, if present. 102 //{ 103 // this->ball_->destroy(); 104 // this->ball_ = nullptr; 105 //} 107 106 108 107 if (this->futureWall_ != nullptr) … … 135 134 if (this->center_ != nullptr) // There needs to be a OrxoBloxCenterpoint, i.e. the area the game takes place. 136 135 { 137 if (this->ball_ == nullptr) // If there is no ball, create a new ball.138 {139 this->ball_ = new OrxoBloxBall(this->center_->getContext());136 //if (this->ball_ == nullptr) // If there is no ball, create a new ball. 137 //{ 138 // this->ball_ = new OrxoBloxBall(this->center_->getContext()); 140 139 // Apply the template for the ball specified by the centerpoint. 141 this->ball_->addTemplate(this->center_->getBalltemplate());142 }140 // this->ball_->addTemplate(this->center_->getBalltemplate()); 141 //} 143 142 144 143 // Attach the ball to the centerpoint and set the parameters as specified in the centerpoint, the ball is attached to. 145 this->center_->attach(this->ball_);144 //this->center_->attach(this->ball_); 146 145 //Startposition Ball 147 this->ball_->setPosition(0, 0, 40);148 this->ball_->setFieldDimension(this->center_->getFieldDimension());149 this->ball_->setSpeed(0);150 this->ball_->setAccelerationFactor(this->center_->getBallAccelerationFactor());146 //this->ball_->setPosition(0, 0, 40); 147 //this->ball_->setFieldDimension(this->center_->getFieldDimension()); 148 //this->ball_->setSpeed(0); 149 //this->ball_->setAccelerationFactor(this->center_->getBallAccelerationFactor()); 151 150 152 151 level_=1; … … 286 285 Starts the ball with some default speed. 287 286 */ 288 void OrxoBlox::startBall()289 {290 if (this->ball_ != nullptr && this->center_ != nullptr)291 this->ball_->setSpeed(this->center_->getBallSpeed());292 }287 //void OrxoBlox::startBall() 288 //{ 289 // if (this->ball_ != nullptr && this->center_ != nullptr) 290 // this->ball_->setSpeed(this->center_->getBallSpeed()); 291 //} 293 292 294 OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) { 295 293 /*OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) { 296 294 //orxout() << "Checking for Collision" << endl; 297 295 Vector3 BallPosition = Ball->getPosition(); … … 314 312 return nullptr; 315 313 } 314 */ 316 315 317 316 void OrxoBlox::playerPreSpawn(PlayerInfo* player) -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
r12370 r12371 89 89 OrxoBloxCenterpoint* getCenterpoint(void) 90 90 { return this->center_; } 91 OrxoBloxStones* CheckForCollision(OrxoBloxBall* Ball);91 //OrxoBloxStones* CheckForCollision(OrxoBloxBall* Ball); 92 92 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command 93 93 protected: … … 95 95 void startWall(void); 96 96 void createWall(void); 97 void startBall(); //!< Starts the ball with some default speed.97 //void startBall(); //!< Starts the ball with some default speed. 98 98 void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats. 99 99 100 100 WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field. 101 WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.101 //WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball. 102 102 unsigned int level_; 103 103 -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h
r12370 r12371 69 69 { 70 70 class OrxoBlox; 71 class OrxoBloxBall;71 //class OrxoBloxBall; 72 72 class OrxoBloxCenterpoint; 73 73 class OrxoBloxWall; -
code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc
r12368 r12371 34 34 #include "BallProjectile.h" 35 35 #include "../OrxoBlox/OrxoBlox.h" 36 #include "../OrxoBlox/OrxoBloxStones.h" 36 37 #include "gametypes/Gametype.h" 37 38 … … 57 58 this->maxTextureIndex_ = 8; 58 59 this->setDestroyAfterCollision(false); //I want the ball to bounce, not to be destroyed 60 this->fieldWidth_ = 46; 61 this->fieldHeight_ = 49; 59 62 //this->orxoblox_ = this->getOrxoBlox(); 60 63 … … 64 67 void BallProjectile::registerVariables() 65 68 { 66 registerVariable( this->fieldWidth_ );67 registerVariable( this->fieldHeight_ );68 69 registerVariable(this->materialBase_); 69 70 registerVariable( this->speed_ ); … … 145 146 orxout() << "wanna bounce..." << endl; 146 147 bool result = BasicProjectile::processCollision(otherObject, contactPoint, cs); 147 Bounce(otherObject, contactPoint, cs); 148 if (result == true) { 149 if (otherObject->isA(Class(OrxoBloxStones))) { 150 Bounce(otherObject, contactPoint, cs); 151 } 152 } 148 153 orxout() << "BOUNCED!" << endl; 149 154 … … 175 180 Vector3 acceleration = this->getAcceleration(); 176 181 182 velocity.y = 0; 183 position.y = 0; 184 177 185 // If the ball has gone over the top or bottom boundary of the playing field (i.e. the ball has hit the top or bottom delimiters). 178 if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)186 if (position.z > this->fieldHeight_ || position.z < -this->fieldHeight_) 179 187 { 180 188 181 189 velocity.z = -velocity.z; 182 190 // And its position is set as to not overstep the boundary it has just crossed. Remember z axis is reverted!!! 183 if (position.z > this->fieldHeight_ / 2){191 if (position.z > this->fieldHeight_){ 184 192 // Set the ball to be exactly at the boundary. 185 position.z = this-> fieldHeight_ / 2;193 position.z = this-> fieldHeight_; 186 194 187 195 //orxoblox_->LevelUp(); … … 218 226 219 227 } 220 if (position.z < -this->fieldHeight_ / 2){221 position.z = -this->fieldHeight_ / 2;228 if (position.z < -this->fieldHeight_){ 229 position.z = -this->fieldHeight_; 222 230 223 231 } … … 228 236 //Ball hits the right or left wall and should bounce back. 229 237 // If the ball has crossed the left or right boundary of the playing field. 230 if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)238 if (position.x > this->fieldWidth_ || position.x < -this->fieldWidth_) 231 239 { 232 240 //Ball hits the right Wall 233 if (position.x > this->fieldWidth_ / 2)241 if (position.x > this->fieldWidth_) 234 242 { 235 243 // Set the ball to be exactly at the boundary. 236 position.x = this->fieldWidth_ / 2;244 position.x = this->fieldWidth_; 237 245 // Invert its velocity in x-direction (i.e. it bounces off). 238 246 velocity.x = -velocity.x; … … 241 249 242 250 //Ball hits the left wall 243 else if (position.x < -this->fieldWidth_ / 2)251 else if (position.x < -this->fieldWidth_) 244 252 { 245 253 // Set the ball to be exactly at the boundary. 246 position.x = -this->fieldWidth_ / 2;254 position.x = -this->fieldWidth_; 247 255 // Invert its velocity in x-direction (i.e. it bounces off). 248 256 velocity.x = -velocity.x; -
code/branches/OrxoBlox_FS19/src/modules/weapons/weaponmodes/BallGun.cc
r12281 r12371 34 34 #include "BallGun.h" 35 35 36 36 37 #include "core/CoreIncludes.h" 37 38 #include "core/XMLPort.h" … … 59 60 this->reloadTime_ = 0.25f; 60 61 this->damage_ = 0.0f; //default 15 61 this->speed_ = 750.0f;62 this->delay_ = 0.0f;62 this->speed_ = 50; 63 this->delay_ = 100; 63 64 this->setMunitionName("BallMunition"); 64 65 this->mesh_ = "laserbeam.mesh";
Note: See TracChangeset
for help on using the changeset viewer.