Changeset 12368 for code/branches
- Timestamp:
- May 16, 2019, 11:11:39 AM (6 years ago)
- Location:
- code/branches/OrxoBlox_FS19
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/data/levels/includes/OrxoBloxWeapon.oxi
r12315 r12368 14 14 </links> 15 15 <Weapon> 16 < Asteroids2DWeapon mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="laserbeam.mesh" />16 <BallGun mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="laserbeam.mesh" /> 17 17 </Weapon> 18 18 <Weapon> 19 < Asteroids2DWeapon mode=0 munitionpershot=0 delay=0 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="laserbeam.mesh" />19 <BallGun mode=0 munitionpershot=0 delay=0 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="laserbeam.mesh" /> 20 20 </Weapon> 21 21 </WeaponPack> … … 27 27 </weaponpacks> 28 28 <munition> 29 < LaserMunition initialmagazines=8 maxmagazines=8 munitionpermagazine=10 replenishamount=1 replenishinterval=0.5/>29 <BallMunition initialmagazines=8 maxmagazines=8 munitionpermagazine=10 replenishamount=1 replenishinterval=0.5/> 30 30 </munition> -
code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
r12367 r12368 42 42 <ParticleSpawner name=hiteffect position="0,0,0" source="Orxonox/sparks2" lifetime=0.01 autostart=0 mainstate=spawn /> 43 43 </attached> 44 <collisionShapes> 45 <SphereCollisionShape radius="2" /> 46 </collisionShapes> 44 47 <eventlisteners> 45 48 <EventTarget target=hiteffect /> … … 56 59 <Model position="0,0,0" mesh="cube_orange.mesh" scale=4.3 /> 57 60 </attached> 61 <collisionShapes> 62 <BoxCollisionShape halfExtents="4.5, 4.5, 4.5" /> 63 </collisionShapes> 58 64 </OrxoBloxStones> 59 65 </Template> … … 63 69 <Template name=OrxoBloxwall> 64 70 <OrxoBloxWall> 71 <collisionShapes> 72 <BoxCollisionShape halfExtents="4.5, 4.5, 4.5" /> 73 </collisionShapes> 65 74 </OrxoBloxWall> 66 75 </Template> -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
r12367 r12368 106 106 } 107 107 108 if (this->futureWall_ )108 if (this->futureWall_ != nullptr) 109 109 { 110 110 this->futureWall_->destroy(); … … 113 113 114 114 for (OrxoBloxWall* wall : this->activeWalls_) 115 if (wall != nullptr) 115 116 wall->destroy(); 116 117 this->activeWalls_.clear(); … … 118 119 119 120 for (OrxoBloxStones* stone : this->stones_) 121 if(stone != nullptr) 120 122 stone->destroy(); 121 123 this->stones_.clear(); … … 285 287 this->ball_->setSpeed(this->center_->getBallSpeed()); 286 288 } 287 289 288 290 OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) { 289 291 … … 314 316 } 315 317 318 /* 319 bool OrxoBlox::Intersect(int XpositionBall, int XPositionBlock, int YPositionBall, int YPositionBlock, int radiusBall, int sizeBlock) { 320 distanceX = XpositionBall - XPositionBlock; 321 distanceY = YPositionBall - YPositionBlock; 322 if (distanceX < 0) { 323 distanceX = -distanceX; 324 } 325 if (distanceY < 0) { 326 distanceY = -distanceY; 327 } 328 if((distanceX <= radiusBall + sizeBlock) || (distanceY <= radiusBall + sizeBlock)) { 329 return true; 330 } 331 else { 332 top = YPositionBall + radiusBall; 333 right = XpositionBall + radiusBall; 334 bottom = YPositionBall - radiusBall; 335 left = XpositionBall - radiusBall; 336 337 if((top >= YPositionBlock - size) && (top <= YPositionBlock + size) && (left <= XPositionBlock + size) && (left >= XPositionBlock - size)) 338 } 339 } 340 */ 316 341 } -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.cc
r12366 r12368 68 68 this->relMercyOffset_ = 0.05f; 69 69 this->orxoblox_ = this->getOrxoBlox(); 70 this->radius_ = 1.5;70 this->radius_ = 3; 71 71 72 72 this->registerVariables(); … … 137 137 138 138 // 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). 139 if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)139 if (position.z > this->fieldHeight_ / 2 || position.z - radius_ < -this->fieldHeight_ / 2) 140 140 { 141 141 defBoundarySound_->play(); //play boundary sound 142 142 // Its velocity in z-direction is inverted (i.e. it bounces off). 143 143 velocity.z = -velocity.z; 144 // And its position is set as to not overstep the boundary it has just crossed. 144 // And its position is set as to not overstep the boundary it has just crossed. Remember z axis is reverted!!! 145 145 if (position.z > this->fieldHeight_ / 2){ 146 146 // Set the ball to be exactly at the boundary. 147 position.z = this-> fieldHeight_ / 2 ;147 position.z = this-> fieldHeight_ / 2 - radius_; 148 148 149 149 orxoblox_->LevelUp(); … … 180 180 181 181 } 182 if (position.z < -this->fieldHeight_ / 2){183 position.z = -this->fieldHeight_ / 2 ;182 if (position.z - radius_ < -this->fieldHeight_ / 2){ 183 position.z = -this->fieldHeight_ / 2 + radius_; 184 184 185 185 } … … 190 190 //Ball hits the right or left wall and should bounce back. 191 191 // If the ball has crossed the left or right boundary of the playing field. 192 if (position.x > this->fieldWidth_ / 2 || position.x< -this->fieldWidth_ / 2)192 if (position.x + radius_ > this->fieldWidth_ / 2 || position.x - radius_ < -this->fieldWidth_ / 2) 193 193 { 194 194 //Ball hits the right Wall 195 if (position.x > this->fieldWidth_ / 2)195 if (position.x + radius_ > this->fieldWidth_ / 2) 196 196 { 197 197 // Set the ball to be exactly at the boundary. 198 position.x = this->fieldWidth_ / 2 ;198 position.x = this->fieldWidth_ / 2 - radius_; 199 199 // Invert its velocity in x-direction (i.e. it bounces off). 200 200 velocity.x = -velocity.x; … … 203 203 204 204 //Ball hits the left wall 205 else if (position.x < -this->fieldWidth_ / 2)205 else if (position.x - radius_ < -this->fieldWidth_ / 2) 206 206 { 207 207 // Set the ball to be exactly at the boundary. 208 position.x = -this->fieldWidth_ / 2 ;208 position.x = -this->fieldWidth_ / 2 + radius_; 209 209 // Invert its velocity in x-direction (i.e. it bounces off). 210 210 velocity.x = -velocity.x; … … 220 220 if (position != this->getPosition()) 221 221 this->setPosition(position); 222 this->Collides((this->orxoblox_->CheckForCollision(this)));222 //this->Collides((this->orxoblox_->CheckForCollision(this))); 223 223 224 224 … … 289 289 290 290 291 void OrxoBloxBall::Bounce( OrxoBloxStones* Stone) {291 void OrxoBloxBall::Bounce(WorldEntity* Stone) { 292 292 293 293 Vector3 velocity = this->getVelocity(); … … 337 337 Bounce(Stone); 338 338 //if(otherObject->getHealth() <= 0) { 339 Stone->destroy();339 //Stone->destroy(); 340 340 341 341 //} 342 342 //otherObject->reduceHealth(); 343 } 344 345 bool OrxoBloxBall::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 346 { 347 orxout() << "detected collision" << endl; 348 Bounce(otherObject); 349 350 return true; 343 351 } 344 352 -
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxBall.h
r12366 r12368 111 111 112 112 113 void Bounce( OrxoBloxStones* otherObject);113 void Bounce(WorldEntity* Stone); 114 114 void Collides(OrxoBloxStones* otherObject); 115 bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 115 116 116 117 static const float MAX_REL_Z_VELOCITY; -
code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc
r12310 r12368 33 33 34 34 #include "BallProjectile.h" 35 #include "../OrxoBlox/OrxoBlox.h" 36 #include "gametypes/Gametype.h" 37 35 38 36 39 #include <OgreParticleEmitter.h> … … 54 57 this->maxTextureIndex_ = 8; 55 58 this->setDestroyAfterCollision(false); //I want the ball to bounce, not to be destroyed 59 //this->orxoblox_ = this->getOrxoBlox(); 56 60 57 61 //setEffect("Orxonox/sparks2"); … … 135 139 } 136 140 137 138 139 140 141 141 142 bool BallProjectile::processCollision(WorldEntity* otherObject, btManifoldPoint& contactPoint, const btCollisionShape* cs) … … 151 152 152 153 153 154 154 /* 155 OrxoBlox* BallProjectile::getOrxoBlox() 156 { 157 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(OrxoBlox))) 158 { 159 OrxoBlox* orxobloxGametype = orxonox_cast<OrxoBlox*>(this->getGametype()); 160 return orxobloxGametype; 161 } 162 else orxout()<<"There is no Gametype for OrxoBlox! ask Anna"<< endl; 163 return nullptr; 164 } 165 */ 155 166 156 167 … … 159 170 SUPER(BallProjectile, tick, dt); 160 171 161 // Get the current position, velocity and acceleration of the ball.172 // Get the current position, velocity and acceleration of the ball. 162 173 Vector3 position = this->getPosition(); 163 174 Vector3 velocity = this->getVelocity(); … … 167 178 if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2) 168 179 { 169 // Its velocity in z-direction is inverted (i.e. it bounces off). 180 170 181 velocity.z = -velocity.z; 171 // And its position is set as to not overstep the boundary it has just crossed. 172 if (position.z > this->fieldHeight_ / 2) 173 position.z = this->fieldHeight_ / 2; 174 if (position.z < -this->fieldHeight_ / 2) 175 position.z = -this->fieldHeight_ / 2; 182 // 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){ 184 // Set the ball to be exactly at the boundary. 185 position.z = this-> fieldHeight_ / 2; 186 187 //orxoblox_->LevelUp(); 188 189 190 //this->setSpeed(0); // doesn't work here, why??; 191 //Stopping ball 192 orxout() << "Ball stopped" << endl; 193 velocity.x = 0; 194 velocity.y = 0; 195 velocity.z = 0; 196 197 //ChatManager::message("Waiting for your input"); 198 //Input new speed here: 199 //ChatManager::message("Setting new speed"); 200 201 //%%%%%%%%%%%% 202 //MAUSPOSITION 203 //%%%%%%%%%%%% 204 //Reads current mouse position 205 //TODO: read Mouse position on click! 206 //int mousex = InputManager::getInstance().getMousePosition().first; 207 //int mousey = InputManager::getInstance().getMousePosition().second; 208 //ChatManager::message("Read mouse position"); 209 //orxout() << "Mouseposition" << endl; 210 //orxout() << mousex << endl; 211 //ChatManager::message(mousex); 212 //ChatManager::message("mousey"); 213 //ChatManager::message(mousey); 214 //Set new speed here!! 215 velocity.x = rnd(-100,100); 216 velocity.z = rnd(-50,-100); 217 218 219 } 220 if (position.z < -this->fieldHeight_ / 2){ 221 position.z = -this->fieldHeight_ / 2 ; 222 223 } 176 224 177 225 this->fireEvent(); … … 210 258 if (position != this->getPosition()) 211 259 this->setPosition(position); 212 } 213 260 //this->Collides((this->orxoblox_->CheckForCollision(this))); 261 262 } 214 263 215 264 -
code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.h
r12310 r12368 37 37 #include "weapons/WeaponsPrereqs.h" 38 38 #include "weapons/projectiles/BillboardProjectile.h" 39 #include "../OrxoBlox/OrxoBlox.h" 40 41 #include "OrxoBlox/OrxoBloxPrereqs.h" 39 42 40 43 namespace orxonox … … 65 68 void registerVariables(); 66 69 void changeTexture(); 70 //OrxoBlox* getOrxoBlox(); 67 71 68 72 float speed_; //!< The speed (in x-direction) of the ball. … … 72 76 unsigned int maxTextureIndex_; //!< The maximal index. 73 77 std::string materialBase_; //!< The base name of the material. 78 //OrxoBlox* orxoblox_; 74 79 }; 75 80 }
Note: See TracChangeset
for help on using the changeset viewer.