[Orxonox-commit 7779] r12371 - in code/branches/OrxoBlox_FS19: data/levels src/modules/OrxoBlox src/modules/weapons/projectiles src/modules/weapons/weaponmodes

pomselj at orxonox.net pomselj at orxonox.net
Thu May 16 13:13:58 CEST 2019


Author: pomselj
Date: 2019-05-16 13:13:58 +0200 (Thu, 16 May 2019)
New Revision: 12371

Modified:
   code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h
   code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc
   code/branches/OrxoBlox_FS19/src/modules/weapons/weaponmodes/BallGun.cc
Log:
BallProjectiles fly

Modified: code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
===================================================================
--- code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw	2019-05-16 11:13:21 UTC (rev 12370)
+++ code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw	2019-05-16 11:13:58 UTC (rev 12371)
@@ -92,7 +92,7 @@
   >
     <!-- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> -->
     <Light type=directional position="-100, 10000, -700" direction="0.2, -1, 0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
-    <SpawnPoint team=0 position="0,150,0" lookat="0,0,0" spawnclass= OrxoBloxShip pawndesign=spaceshipOrxoBlox/>
+    <SpawnPoint team=0 position="0,-4.5,49" lookat="-49,-4.5,0" spawnclass= OrxoBloxShip pawndesign=spaceshipOrxoBlox/>
 
     <!--<Model mesh="axes.mesh" scale=10 position="0,0,0" /> -->
 

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt	2019-05-16 11:13:21 UTC (rev 12370)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/CMakeLists.txt	2019-05-16 11:13:58 UTC (rev 12371)
@@ -2,7 +2,6 @@
 
   OrxoBlox.cc
   OrxoBloxWall.cc
-  OrxoBloxBall.cc
   OrxoBloxCenterpoint.cc
   OrxoBloxStones.cc
   OrxoBloxScore.cc

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-16 11:13:21 UTC (rev 12370)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-16 11:13:58 UTC (rev 12371)
@@ -47,7 +47,6 @@
 #include "chat/ChatManager.h"//Remove?
 
 #include "OrxoBloxCenterpoint.h"
-#include "OrxoBloxBall.h"
 #include "OrxoBloxStones.h"
 #include "OrxoBloxWall.h"
 #include "OrxoBloxShip.h"
@@ -67,7 +66,7 @@
         RegisterObject(OrxoBlox);
 
         this->center_ = nullptr;
-        this->ball_ = nullptr;
+        //this->ball_ = nullptr;
         this->futureWall_ = nullptr;
         this->player_ = nullptr;
         level_ = 0;
@@ -76,7 +75,7 @@
         //Error when specified
 
         // Pre-set the timer, but don't start it yet.
-        this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&OrxoBlox::startBall, this)));
+        this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&OrxoBlox::LevelUp, this)));
         this->starttimer_.stopTimer();
 
         
@@ -99,11 +98,11 @@
     */
     void OrxoBlox::cleanup()
     {
-        if (this->ball_ != nullptr) // Destroy the ball, if present.
-        {
-            this->ball_->destroy();
-            this->ball_ = nullptr;
-        }
+        //if (this->ball_ != nullptr) // Destroy the ball, if present.
+        //{
+        //    this->ball_->destroy();
+        //    this->ball_ = nullptr;
+        //}
 
         if (this->futureWall_ != nullptr)
             {
@@ -134,20 +133,20 @@
     {
         if (this->center_ != nullptr) // There needs to be a OrxoBloxCenterpoint, i.e. the area the game takes place.
         {
-            if (this->ball_ == nullptr) // If there is no ball, create a new ball.
-            {
-                this->ball_ = new OrxoBloxBall(this->center_->getContext());
+            //if (this->ball_ == nullptr) // If there is no ball, create a new ball.
+            //{
+            //    this->ball_ = new OrxoBloxBall(this->center_->getContext());
                 // Apply the template for the ball specified by the centerpoint.
-                this->ball_->addTemplate(this->center_->getBalltemplate());
-            }
+            //    this->ball_->addTemplate(this->center_->getBalltemplate());
+            //}
 
             // Attach the ball to the centerpoint and set the parameters as specified in the centerpoint, the ball is attached to.
-            this->center_->attach(this->ball_);
+            //this->center_->attach(this->ball_);
             //Startposition Ball
-            this->ball_->setPosition(0, 0, 40);
-            this->ball_->setFieldDimension(this->center_->getFieldDimension());
-            this->ball_->setSpeed(0);
-            this->ball_->setAccelerationFactor(this->center_->getBallAccelerationFactor());
+            //this->ball_->setPosition(0, 0, 40);
+            //this->ball_->setFieldDimension(this->center_->getFieldDimension());
+            //this->ball_->setSpeed(0);
+            //this->ball_->setAccelerationFactor(this->center_->getBallAccelerationFactor());
             
             level_=1;
 
@@ -285,14 +284,13 @@
     @brief
         Starts the ball with some default speed.
     */
-    void OrxoBlox::startBall()
-    {
-        if (this->ball_ != nullptr && this->center_ != nullptr)
-            this->ball_->setSpeed(this->center_->getBallSpeed());
-    }
+    //void OrxoBlox::startBall()
+    //{
+    //    if (this->ball_ != nullptr && this->center_ != nullptr)
+    //        this->ball_->setSpeed(this->center_->getBallSpeed());
+    //}
      
-    OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) {
-
+    /*OrxoBloxStones* OrxoBlox::CheckForCollision(OrxoBloxBall* Ball) {
         //orxout() << "Checking for Collision" << endl;
         Vector3 BallPosition = Ball->getPosition();
         for(OrxoBloxStones* someStone : this->stones_)
@@ -313,6 +311,7 @@
         orxout() << "Found nothing...." << endl;
         return nullptr;
     }
+    */
 
     void OrxoBlox::playerPreSpawn(PlayerInfo* player)
     {

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-05-16 11:13:21 UTC (rev 12370)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-05-16 11:13:58 UTC (rev 12371)
@@ -88,17 +88,17 @@
 
             OrxoBloxCenterpoint* getCenterpoint(void)
                 { return this->center_; }
-            OrxoBloxStones* CheckForCollision(OrxoBloxBall* Ball);
+            //OrxoBloxStones* CheckForCollision(OrxoBloxBall* Ball);
             virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
         protected:
         private:
             void startWall(void);
             void createWall(void);
-            void startBall(); //!< Starts the ball with some default speed.
+            //void startBall(); //!< Starts the ball with some default speed.
             void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats.
 
             WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field.
-            WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
+            //WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
             unsigned int level_;
 
             WeakPtr<OrxoBloxShip> playership;

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h	2019-05-16 11:13:21 UTC (rev 12370)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxPrereqs.h	2019-05-16 11:13:58 UTC (rev 12371)
@@ -68,7 +68,7 @@
 namespace orxonox
 {
     class OrxoBlox;
-    class OrxoBloxBall;
+    //class OrxoBloxBall;
     class OrxoBloxCenterpoint;
     class OrxoBloxWall;
     class OrxoBloxStones;

Modified: code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc	2019-05-16 11:13:21 UTC (rev 12370)
+++ code/branches/OrxoBlox_FS19/src/modules/weapons/projectiles/BallProjectile.cc	2019-05-16 11:13:58 UTC (rev 12371)
@@ -33,6 +33,7 @@
 
 #include "BallProjectile.h"
 #include "../OrxoBlox/OrxoBlox.h"
+#include "../OrxoBlox/OrxoBloxStones.h"
 #include "gametypes/Gametype.h"
 
 
@@ -56,6 +57,8 @@
         this->setMass(0.1f);
         this->maxTextureIndex_ = 8;
         this->setDestroyAfterCollision(false); //I want the ball to bounce, not to be destroyed
+        this->fieldWidth_ = 46;
+        this->fieldHeight_ =  49;
         //this->orxoblox_ = this->getOrxoBlox();
 
         //setEffect("Orxonox/sparks2");
@@ -63,8 +66,6 @@
 
     void BallProjectile::registerVariables()
     {
-        registerVariable( this->fieldWidth_ );
-        registerVariable( this->fieldHeight_ );
         registerVariable(this->materialBase_);
         registerVariable( this->speed_ );
     }
@@ -144,7 +145,11 @@
 
         orxout() << "wanna bounce..." << endl;
         bool result = BasicProjectile::processCollision(otherObject, contactPoint, cs);
-        Bounce(otherObject, contactPoint, cs);
+        if (result == true) {
+            if (otherObject->isA(Class(OrxoBloxStones))) {
+                Bounce(otherObject, contactPoint, cs);
+            }
+        }
         orxout() << "BOUNCED!" << endl;
 
         return result;
@@ -174,15 +179,18 @@
         Vector3 velocity = this->getVelocity();
         Vector3 acceleration = this->getAcceleration();
 
+        velocity.y = 0;
+        position.y = 0;
+
         // 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).
-        if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2)
+        if (position.z > this->fieldHeight_ || position.z < -this->fieldHeight_)
         {
 
             velocity.z = -velocity.z;
             // And its position is set as to not overstep the boundary it has just crossed. Remember z axis is reverted!!!
-            if (position.z > this->fieldHeight_ / 2){
+            if (position.z > this->fieldHeight_){
                 // Set the ball to be exactly at the boundary.
-                position.z = this-> fieldHeight_ / 2;
+                position.z = this-> fieldHeight_;
                 
                 //orxoblox_->LevelUp();
 
@@ -217,8 +225,8 @@
                 
 
             }
-            if (position.z < -this->fieldHeight_ / 2){
-                position.z = -this->fieldHeight_ / 2 ;
+            if (position.z < -this->fieldHeight_){
+                position.z = -this->fieldHeight_;
                 
             }
 
@@ -227,13 +235,13 @@
         
         //Ball hits the right or left wall and should bounce back.
         // If the ball has crossed the left or right boundary of the playing field.
-        if (position.x > this->fieldWidth_ / 2 || position.x < -this->fieldWidth_ / 2)
+        if (position.x > this->fieldWidth_ || position.x < -this->fieldWidth_)
         {
             //Ball hits the right Wall
-            if (position.x > this->fieldWidth_ / 2)
+            if (position.x > this->fieldWidth_)
                 {
                     // Set the ball to be exactly at the boundary.
-                    position.x = this->fieldWidth_ / 2;
+                    position.x = this->fieldWidth_;
                     // Invert its velocity in x-direction (i.e. it bounces off).
                     velocity.x = -velocity.x;
                     this->fireEvent();
@@ -240,10 +248,10 @@
                     }
 
             //Ball hits the left wall
-            else if (position.x < -this->fieldWidth_ / 2)
+            else if (position.x < -this->fieldWidth_)
                 {
                         // Set the ball to be exactly at the boundary.
-                        position.x = -this->fieldWidth_ / 2;
+                        position.x = -this->fieldWidth_;
                         // Invert its velocity in x-direction (i.e. it bounces off).
                         velocity.x = -velocity.x;
                         this->fireEvent();

Modified: code/branches/OrxoBlox_FS19/src/modules/weapons/weaponmodes/BallGun.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/weapons/weaponmodes/BallGun.cc	2019-05-16 11:13:21 UTC (rev 12370)
+++ code/branches/OrxoBlox_FS19/src/modules/weapons/weaponmodes/BallGun.cc	2019-05-16 11:13:58 UTC (rev 12371)
@@ -33,6 +33,7 @@
 
 #include "BallGun.h"
 
+
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "core/command/Executor.h"
@@ -58,8 +59,8 @@
 
         this->reloadTime_ = 0.25f;
         this->damage_ = 0.0f; //default 15
-        this->speed_ = 750.0f;
-        this->delay_ = 0.0f;
+        this->speed_ = 50;
+        this->delay_ = 100;
         this->setMunitionName("BallMunition");
         this->mesh_ = "laserbeam.mesh";
 



More information about the Orxonox-commit mailing list