Changeset 12371 for code/branches/OrxoBlox_FS19/src/modules/weapons
- Timestamp:
- May 16, 2019, 1:13:58 PM (6 years ago)
- Location:
- code/branches/OrxoBlox_FS19/src/modules/weapons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.