[Orxonox-commit 6774] r11402 - in code/branches/SuperOrxoBros_FS17: data/levels src/modules/superorxobros

jkindle at orxonox.net jkindle at orxonox.net
Tue Apr 25 14:51:45 CEST 2017


Author: jkindle
Date: 2017-04-25 14:51:44 +0200 (Tue, 25 Apr 2017)
New Revision: 11402

Added:
   code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc
   code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h
Modified:
   code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw
   code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
   code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc
   code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
   code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
   code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
Log:
Added mushrooms and deadzone

Modified: code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw
===================================================================
--- code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw	2017-04-13 13:47:48 UTC (rev 11401)
+++ code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw	2017-04-25 12:51:44 UTC (rev 11402)
@@ -127,11 +127,19 @@
 
 
 
+<SOBMushroom collisionType="dynamic" speed=30>
+						<attached>
+							<Model mesh="Cube1.1.mesh" position="0,0,20" scale=10/> 
+							
+						</attached>
+						<collisionShapes>
+							<BoxCollisionShape position="0,0,20" halfExtents="5,5,5" /><!-- 1 -->
+						</collisionShapes>
+					</SOBMushroom>
 
 
 
 
-
 <!-- 					<Model mesh="Cube1.1.mesh" position="120,0,20" scale=10/><!-- ? Block --> 		<!-- 1 -->
 					<Model mesh="Cube1.1.mesh" position="160,0,20" scale=10 /> 						<!-- 2 -->
 					<Model mesh="Cube1.1.mesh" position="170,0,20" scale=10 /><!-- Item Block --> 	<!-- 3 -->

Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt	2017-04-13 13:47:48 UTC (rev 11401)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt	2017-04-25 12:51:44 UTC (rev 11402)
@@ -5,6 +5,7 @@
   SOBFigure.cc
   SOBItem.cc
   SOBQBlock.cc
+  SOBMushroom.cc
 
 )
 

Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc	2017-04-13 13:47:48 UTC (rev 11401)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc	2017-04-25 12:51:44 UTC (rev 11402)
@@ -63,6 +63,7 @@
 
         this->center_ = nullptr;
         figure_ = nullptr;
+        setHUDTemplate("JumpHUD");
 
     }
 
@@ -143,7 +144,14 @@
         }
     }
 
+void SOB::tick(float dt)
+    {
+        SUPER(SOB, tick, dt);
 
+        if (this->figure_ != nullptr && figure_->dead_)
+            orxout() << "DEED" << endl;
+       
+    }
 
 
 }

Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h	2017-04-13 13:47:48 UTC (rev 11401)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h	2017-04-25 12:51:44 UTC (rev 11402)
@@ -51,6 +51,7 @@
         public:
             SOB(Context* context); //!< Constructor. Registers and initializes the object.
             virtual ~SOB(); //!< Destructor. Cleans up, if initialized.
+            virtual void tick(float dt) override;
 
        
             void setCenterpoint(SOBCenterpoint* center)

Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc	2017-04-13 13:47:48 UTC (rev 11401)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc	2017-04-25 12:51:44 UTC (rev 11402)
@@ -39,6 +39,7 @@
 #include "graphics/Camera.h"
 #include "graphics/ParticleSpawner.h"
 
+#include "SOBMushroom.h"
 
 namespace orxonox
 {
@@ -73,8 +74,12 @@
     bool SOBFigure::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
 
         isColliding_ = true;
+        SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject);
+        if (mush != nullptr) {
+            orxout() << "YEPPIE" << endl;
+            //DESTROY THE OTHER OBJECT otherObject.destroyLater();
+        }
 
-
 return true;
     }
 
@@ -106,6 +111,7 @@
 
 
 
+
         if (firePressed_ == false) {
              gravityAcceleration_ = 350.0;
 
@@ -116,6 +122,10 @@
           Vector3 velocity = getVelocity();
           Vector3 position = getPosition();
 
+
+          if (position.z < -100)
+            dead_ = true;
+
           if (dead_) {
             velocity.x = 0;
             velocity.z = 0;

Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc	                        (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc	2017-04-25 12:51:44 UTC (rev 11402)
@@ -0,0 +1,100 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file SOBMushroom.cc
+    @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
+*/
+
+#include "SOBMushroom.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SOBFigure.h"
+#include "util/Output.h"
+
+
+namespace orxonox
+{
+    RegisterClass(SOBMushroom);
+
+    SOBMushroom::SOBMushroom(Context* context) : MovableEntity(context)
+    {
+        RegisterObject(SOBMushroom);
+
+        attachedToFigure_ = false;
+        setAngularFactor(0.0);
+        figure_ = nullptr;
+        this->enableCollisionCallback();
+        gravityAcceleration_ = 350.0;
+        speed_ = 0.0;
+       
+    }
+
+    
+
+    void SOBMushroom::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(SOBMushroom, XMLPort, xmlelement, mode);
+        XMLPortParam(SOBMushroom, "speed", setSpeed, getSpeed, xmlelement, mode);
+
+
+     }
+
+   
+    bool SOBMushroom::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
+
+//orxout() << "Watshc bum baem" << endl;
+return true;
+    }
+
+
+    void SOBMushroom::setFigure(SOBFigure* newFigure)
+    {
+        figure_ = newFigure;
+    }
+
+    void SOBMushroom::touchFigure()
+    {
+
+    }
+
+    void SOBMushroom::tick(float dt)
+    {
+        SUPER(SOBMushroom, tick, dt);
+
+          Vector3 velocity = getVelocity();
+        velocity.z -= gravityAcceleration_*dt;
+        velocity.x = speed_;
+        setVelocity(velocity);
+
+
+    
+
+}
+}

Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h	                        (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h	2017-04-25 12:51:44 UTC (rev 11402)
@@ -0,0 +1,71 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file SOBMushroom.h
+    @brief Declaration of the SOBMushroom class.
+    @ingroup SOB
+*/
+
+#ifndef _SOBMushroom_H__
+#define _SOBMushroom_H__
+
+#include "superorxobros/SOBPrereqs.h"
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+    class _SOBExport SOBMushroom : public MovableEntity
+    {
+        public:
+            SOBMushroom(Context* context);
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+            virtual void setFigure(SOBFigure* newFigure);
+            virtual void touchFigure();
+            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+            virtual void tick(float dt) override;
+
+          
+            bool attachedToFigure_;
+
+            void setSpeed(const float speed)
+                { this->speed_ = speed; }
+            float getSpeed() const
+                { return speed_; }
+
+
+        protected:
+            float gravityAcceleration_;
+            float speed_;
+            WeakPtr<SOBFigure> figure_;
+           
+    };
+}
+
+#endif /* _SOBMushroom_H__ */

Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h	2017-04-13 13:47:48 UTC (rev 11401)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h	2017-04-25 12:51:44 UTC (rev 11402)
@@ -78,6 +78,7 @@
     class SOBFigure;
     class SOBItem;
     class SOBQBlock;
+    class SOBMushroom;
     /*
     class PongScore;*/
 }



More information about the Orxonox-commit mailing list