Changeset 12360 for code/branches/OrxoBlox_FS19/src/modules
- Timestamp:
- May 9, 2019, 3:32:40 PM (6 years ago)
- Location:
- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
r12359 r12360 242 242 this->stones_.push_back(this->futureWall_->getStone(i)); 243 243 } 244 245 for(OrxoBloxWall* wall : this->activeWalls_) { 246 if(wall->isEmpty()) { 247 wall->destroy(); 248 } 249 int NumberOfStones = 0; 250 for(int i = 0; i < 10; i++) { 251 if(wall->getStone(i) == nullptr) { 252 continue; 253 } 254 else { 255 NumberOfStones++; 256 } 257 258 } 259 } 244 260 //new location of ship 245 261 //new amount of balls … … 283 299 orxout() << "Checking a stone" << endl; 284 300 const Vector3& StonePosition = someStone->getPosition(); //!< Saves the position of the currentStone 285 int size = someStone->getSize() ;286 if((BallPosition.x >= StonePosition.x - size && BallPosition.x<= StonePosition.x + size) &&287 (BallPosition.z >= StonePosition.z - size && BallPosition.z<= StonePosition.z + size)) {301 int size = someStone->getSize()/2; 302 if((BallPosition.x - Ball->getRadius() >= StonePosition.x - size && BallPosition.x + Ball->getRadius() <= StonePosition.x + size) && 303 (BallPosition.z - Ball->getRadius() >= StonePosition.z - size && BallPosition.z + Ball->getRadius() <= StonePosition.z + size)) { 288 304 orxout() << "FOUND ONE" << endl; 289 305 return someStone; -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
r12356 r12360 67 67 this->relMercyOffset_ = 0.05f; 68 68 this->orxoblox_ = this->getOrxoBlox(); 69 this->radius_ = 1.5; 69 70 70 71 this->registerVariables(); … … 302 303 Vector3 myPosition = this->getPosition(); 303 304 orxout() << "About to Bounce >D" << endl; 304 //if (positionOtherObject.y < 0) {305 //this.destroy()306 //}S307 //else {308 305 309 306 int distance_X = myPosition.x - positionStone.x; … … 322 319 if (distance_X < distance_Z) { 323 320 velocity.z = -velocity.z; 324 orxout() << "z" << endl; 321 orxout() << "z" << endl; 325 322 } 326 if (distance_Z < distance_X) {323 else if (distance_Z < distance_X) { 327 324 velocity.x = -velocity.x; 328 orxout() << "x" << endl; 325 orxout() << "x" << endl; 329 326 } 330 327 else { … … 332 329 velocity.z = -velocity.z; 333 330 orxout() << "both" << endl; 334 } 331 } 332 335 333 this->setVelocity(velocity); 334 this->setPosition(myPosition); 336 335 } 337 336 … … 346 345 Bounce(Stone); 347 346 //if(otherObject->getHealth() <= 0) { 348 Stone->destroy(); 347 Stone->destroy(); 348 349 349 //} 350 350 //otherObject->reduceHealth(); … … 362 362 } 363 363 364 float OrxoBloxBall::getRadius() { 365 return this->radius_; 366 } 367 364 368 365 369 } -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h
r12356 r12360 134 134 void setDefBoundarySound(const std::string& engineSound); 135 135 const std::string& getDefBoundarySound(); 136 float getRadius(); 136 137 137 unsigned int getHealth();138 138 139 139 private: … … 141 141 142 142 OrxoBlox* getOrxoBlox(); 143 float radius_; 143 144 float fieldWidth_; //!< The width of the playing field. 144 145 float fieldHeight_; //!< The height of the playing field. -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.cc
r12356 r12360 29 29 this->health_ -= 1; 30 30 } 31 32 float OrxoBloxStones::getSize() { 33 return this->size_; 34 } 31 35 } -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxStones.h
r12356 r12360 67 67 68 68 void reduceHealth(); 69 70 float getSize(); 69 71 70 72 private: -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.cc
r12350 r12360 98 98 return num_Stones_; 99 99 } 100 101 void OrxoBloxWall::setNumberOfStones(int number) { 102 this->num_Stones_ = number; 103 } 104 105 bool OrxoBloxWall::isEmpty() { 106 if (num_Stones_ == 0) { 107 return true; 108 } 109 return false; 110 } 111 112 void OrxoBloxWall::reduceNumberOfStones() { 113 if(num_Stones_ == 0) { 114 orxout() << "Wanted to reduce number of stones, but there were none" << endl; 115 } 116 this->num_Stones_ -= 1; 117 } 100 118 } -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxWall.h
r12346 r12360 43 43 { assert(orxoblox); orxoblox_ = orxoblox; } 44 44 int getNumberOfStones(); 45 bool isEmpty(); 46 void reduceNumberOfStones(); 47 void setNumberOfStones(int number); 45 48 private: 46 49 void createWall(void);
Note: See TracChangeset
for help on using the changeset viewer.