[Orxonox-commit 7371] r11987 - in code/branches/SuperOrxoBros_FS18: data/levels src/modules/superorxobros

micwagne at orxonox.net micwagne at orxonox.net
Thu May 24 15:03:43 CEST 2018


Author: micwagne
Date: 2018-05-24 15:03:43 +0200 (Thu, 24 May 2018)
New Revision: 11987

Modified:
   code/branches/SuperOrxoBros_FS18/data/levels/SOB.oxw
   code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/CMakeLists.txt
   code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOB.cc
   code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.cc
   code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.h
   code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBGumba.cc
   code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBItem.h
   code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBPrereqs.h
Log:
added Tube Function in Game

Modified: code/branches/SuperOrxoBros_FS18/data/levels/SOB.oxw
===================================================================
--- code/branches/SuperOrxoBros_FS18/data/levels/SOB.oxw	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/data/levels/SOB.oxw	2018-05-24 13:03:43 UTC (rev 11987)
@@ -38,7 +38,7 @@
 	<Template name=sobfigurecameras defaults=0>
 		<SOBFigure>
 			<camerapositions>
-				<CameraPosition position="0,-150,30" absolute=true mouselook=false drag=false direction="0,1,0"/>
+				<CameraPosition position="0,-250,30" absolute=true mouselook=false drag=false direction="0,1,0"/>
 			</camerapositions>
 		</SOBFigure>
 	</Template>
@@ -121,9 +121,20 @@
 
 
 
+					<!-- SOBGumbas undergroundlevel-->
+					<SOBGumba collisionType="dynamic" speed=20 position = "350,0,-70">
+						<attached>
+							<Model mesh="Goomba.mesh" position="0,0,1" scale=3 pitch=90/> 
+							
+						</attached>
+						<collisionShapes>
+							<BoxCollisionShape position="0,0,0" halfExtents="5,5,3" /> 			
+						</collisionShapes>
+					</SOBGumba>
 
 
 
+						<!-- SOBGumbas groundlevel-->
 					<SOBGumba collisionType="dynamic" speed=40 position = "240,0,0">
 						<attached>
 							<Model mesh="Goomba.mesh" position="0,0,1" scale=3 pitch=90/> 
@@ -258,13 +269,33 @@
 
 					<StaticEntity collisionType="static" mass='-1'>
 						<collisionShapes>
-							<BoxCollisionShape position="340,0,-20" halfExtents="345,5,5" />
+							<BoxCollisionShape position="140,0,-20" halfExtents="135,5,5" />
+							<BoxCollisionShape position="330,0,-20" halfExtents="30,5,5" />
+							<BoxCollisionShape position="400,0,-20" halfExtents="60,5,5" />
+							<BoxCollisionShape position="530,0,-20" halfExtents="50,5,5" />
+							<BoxCollisionShape position="640,0,-20" halfExtents="40,5,5" />
 						</collisionShapes>
 					</StaticEntity>
+					<!-- Boden 1 Unterirdisch-->
+					<Model mesh="Cube2.12.mesh" position="270,0,-90" scale=10 Pitch=90/> 					<!-- B1.1 -->
+					<Model mesh="Cube2.12.mesh" position="390,0,-90" scale=10 Pitch=90/> 				<!-- B1.2-->
+					
+					<!-- CollisionShape fuer Unterirdisch-->
+					<StaticEntity collisionType="static" mass='-1'>
+						<collisionShapes>
+							<BoxCollisionShape position="390,0,-80" halfExtents="125,5,5" />
+						 
+						</collisionShapes>
+					</StaticEntity>
+					<StaticEntity collisionType="static" mass='1000000000'>
+						<collisionShapes>
+							 
+							<BoxCollisionShape position="265,0,-80" halfExtents="5,5,5" />
+							<BoxCollisionShape position="510,0,-80" halfExtents="5,5,5" />
+						</collisionShapes>
+					</StaticEntity>
 
 
-
-
 					<!-- Luft 1 -->
 
 
@@ -315,12 +346,25 @@
 						</collisionShapes>
 					</SOBQBlock> 
 					
-					<Model mesh="Cube1.1.mesh" position="250,0,20" scale=10/> 												<!-- L1.7 -->
+					
+					<SOBTube collisionType="dynamic" cool=1 position="295,5,-23" mass='10000'>
+						<attached>
+													
+							<Model mesh="Rohr.mesh" position="0,0,-12" scale=10 roll=90 yaw=90 pitch=-90/> 	
+						</attached>
+					</SOBTube> 
+					
+					<SOBTube collisionType="dynamic" cool=1 position="475,5,-3" mass='10000'>
+						<attached>
+													<!-- L1.6 -->
+							<Model mesh="Rohr.mesh" position="0,0,-12" scale=10 roll=90 yaw=90 pitch=-90/> 	
+						</attached>
+					</SOBTube> 
+					
+						<Model mesh="Cube1.1.mesh" position="250,0,20" scale=10/> 											<!-- L1.7 -->
 					<!-- Rohre-->
-					<Model mesh="Rohr.mesh" position="295,5,-35" scale=10 roll=90 yaw=90 pitch=-90/> 						<!-- L1.8 -->
-					<Model mesh="Rohr.mesh" position="395,5,-25" scale=10 roll=90 yaw=90 pitch=-90/>						<!-- L1.9 -->
-					<Model mesh="Rohr.mesh" position="475,5,-15" scale=10 roll=90 yaw=90 pitch=-90 />						<!-- L1.10 -->
-					<Model mesh="Rohr.mesh" position="585,5,-15" scale=10 roll=90 yaw=90 pitch=-90 />						<!-- L1.11 -->	
+										<!-- L1.8 -->
+									<!-- L1.11 -->	
 
 					<SOBQBlock collisionType="static" type="Mushroom" position="650,0,30" mass='-1'>
 						<attached>
@@ -342,24 +386,29 @@
 							
 							<BoxCollisionShape position="210,0,20" halfExtents="5,5,5" /> 						<!-- 1.3 -->
 							<BoxCollisionShape position="230,0,20" halfExtents="5,5,5" /> 						<!-- 1.5 -->
-							<BoxCollisionShape position="250,0,20" halfExtents="5,5,5" /> 						<!-- 1.7 -->
+						
+							<BoxCollisionShape position="250,0,20" halfExtents="5,5,5" />						<!-- 1.7 -->
 							
 
 						</collisionShapes>
 					</StaticEntity>
+						<Model mesh="Rohr.mesh" position="395,0,-25" scale=10 roll=90 yaw=90 pitch=-90/> 	
+						<Model mesh="Rohr.mesh" position="585,0,-15" scale=10 roll=90 yaw=90 pitch=-90/> 	
 
+					<StaticEntity collisionType="static" >
+						
+						
 
-					<StaticEntity collisionType="static" >
 						<collisionShapes>
 							
 
-							<BoxCollisionShape position="295,0,-4" halfExtents="12,5,12" /> 					<!-- 1.8 -->
-							<BoxCollisionShape position="395,0,1" halfExtents="12,5,17" /> 						<!-- 1.9 -->
-							<BoxCollisionShape position="475,0,6" halfExtents="12,5,22" /> 						<!-- 1.10 -->
-							<BoxCollisionShape position="585,0,6" halfExtents="12,5,22" /> 						<!-- 1.11 -->
+											
+							<BoxCollisionShape position="395,0,1" halfExtents="12,5,17" /> 						
+												
+							<BoxCollisionShape position="585,0,6" halfExtents="12,5,22" /> 						
 
 						</collisionShapes>
-					</StaticEntity>
+					</StaticEntity> 
 
 
 

Modified: code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/CMakeLists.txt
===================================================================
--- code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/CMakeLists.txt	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/CMakeLists.txt	2018-05-24 13:03:43 UTC (rev 11987)
@@ -2,6 +2,7 @@
 
   SOBCenterpoint.cc
   SOB.cc
+  SOBTube.cc
   SOBFigure.cc
   SOBItem.cc
   SOBQBlock.cc
@@ -13,6 +14,7 @@
   SOBCastlestone.cc
   SOBCoin.cc
   SOBGumbaBoss.cc
+  
 
 )
 

Modified: code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOB.cc
===================================================================
--- code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOB.cc	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOB.cc	2018-05-24 13:03:43 UTC (rev 11987)
@@ -148,7 +148,7 @@
 
         //If player has reached end of level
         if (this->figure_ != nullptr && figure_->lvlEnded_) {
-            std::stringstream a;
+            std::stringstream a;setLvl(2);
             if(!newHighscore){
                 a << "Nice! " << getPoints() << " Points in " << (400-getTimeLeft())/2 <<"s.\n\nPress <Space> to restart";
             }

Modified: code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.cc	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.cc	2018-05-24 13:03:43 UTC (rev 11987)
@@ -42,6 +42,7 @@
 #include "graphics/ParticleSpawner.h"
 #include <OgreMath.h>
 
+#include "SOBTube.h"
 #include "SOBMushroom.h"
 #include "SOBGumba.h"
 #include "SOBGumbaBoss.h"
@@ -49,7 +50,6 @@
 #include "SOB.h"
 #include "SOBFlagstone.h"
 #include "SOBCastlestone.h"
-#include "SOBFireball.h"
 #include "Highscore.h"
 #include <BulletCollision/NarrowPhaseCollision/btManifoldPoint.h>
 
@@ -71,7 +71,13 @@
         moveRightPressed_    = false;
         firePressed_        = false;
         collDisZ_           = 0;
+        tube                = NULL;
 
+        //Variables for Action in Tube
+        tcol_               = false;
+        tubing              = false; 
+        kkk                 = 0;
+       
         //Times and turning
         timeSinceLastFire_  = 0.0;
         lastSpeed_z         = 0.0;
@@ -88,7 +94,9 @@
         lvlEnded_           = false;
         reachedLvlEndState_ = 0;
 
+        positiontube_=10000;
         // Properties concerning PowerUps and items
+        
         PowerUpCounter_     = 0;
         maxPowerUp_         = 2;
         FireballPower       = 2;
@@ -111,7 +119,10 @@
 
 
         //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr
+        //SOBTube* test;
+       
         SOBMushroom*    mush        = orxonox_cast<SOBMushroom*>    (otherObject);
+        tube                        = orxonox_cast<SOBTube*>        (otherObject);
         SOBGumba*       gumba       = orxonox_cast<SOBGumba*>       (otherObject);
         SOBGumbaBoss*   gumbaBoss   = orxonox_cast<SOBGumbaBoss*>   (otherObject);
         SOBFlagstone*   flagstone   = orxonox_cast<SOBFlagstone*>   (otherObject);
@@ -120,6 +131,7 @@
         SOB* SOBGame                = orxonox_cast<SOB*>            (getGametype()); 
 
 
+
         //Check if otherObject is a powerup-mushroom
         if (mush != nullptr && !(mush->hasCollided_)) {
             otherObject->destroyLater();
@@ -132,14 +144,14 @@
             mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once
             
             
-        }
+        }else if(tube != nullptr && !(tube->hasCollided_)){ //Check if other Object is a tube and set position wher tube is in positiontube_
+            tube->hasCollided_=true;positiontube_=getPosition().x;tcol_=true; //tcol_ used for movedown function in SOBfigure.cc
+                
 
-        
 
-        //Check if otherObject is a Gumba (that walking enemies)
+        }else if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
+            //Check if otherObject is a Gumba (that walking enemies)
 
-         else if (gumba != nullptr && gumbaBoss == nullptr && !(gumba->hasCollided_)) {
-
             //If player jumps on its head, kill the Gumba, else, kill the player
             if (getVelocity().z >= -20) {
                 // If player hasn't a power up, he dies. Else he shrinks and the gumba dies.
@@ -208,7 +220,9 @@
     if (x < 0.0) return -1;
     return 1;
 }
-
+/*bool SOBFigure::tubeAction(){
+return true;
+}*/
 //Function to spawn the Fireball
 void SOBFigure::spawnFireball() {
         SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
@@ -239,10 +253,10 @@
 void SOBFigure::tick(float dt)
 {
     SUPER(SOBFigure, tick, dt);
+    
 
-
     bool inputAllowed = true;
-    //SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+   
 
     //the particle spawner that generates the fire from the backpack when pressed
     if (particlespawner_ == NULL) {
@@ -290,7 +304,7 @@
         if (!predead_)
             velocity.y = 0;
         //If player falls in a hole
-        if (position.z < -100) {
+        if (position.z < -180) {
             dead_ = true;
             SOBGame->setDone(true);
         }
@@ -354,13 +368,43 @@
         }
 
         //If moveUp pressed, fire a fireball
-        if(moveUpPressed_ && (PowerUpCounter_ >= FireballPower) && fireallowed_)
+        if(moveUpPressed_ && inputAllowed) //if pressed up jump through tube if you are underground
         {
+            Vector3 position1 = getPosition();
+
+              
+                
+                
+                if(position1.z>=-100 && position1.z<=-40){
+                    position1.z=40;
+                    if(460<=position1.x && position1.x<480){setPosition(position1);}  //little hack works without this but first tube must be touched     //position where second tube is
+                    if(positiontube_-10<=position1.x && position1.x<positiontube_+10){      //function for jumping through any SOBtube`s
+                    setPosition(position1);}}
+
+
+            if((PowerUpCounter_ >= FireballPower) && fireallowed_){
             spawnFireball();
+
             fireallowed_  = false;
-            firecooldown_ = 0;
+            firecooldown_ = 0;}
         }
+        
+         if(moveDownPressed_ && inputAllowed ){ //if movedownpressed change collisiontype of tube and slip through tube
+                
+              
+                Vector3 position1 = getPosition();
+              
 
+               
+            
+               if(tube != nullptr && !(tube->movedown)){ //Check if other Object is a tube
+               
+                if(positiontube_-10<position1.x && position1.x<positiontube_+10){
+                tube->movedown=true;}
+                }
+   
+        }
+
         //Increase the firecooldown
         if(firecooldown_> 0.5)
         {
@@ -418,6 +462,7 @@
     moveDownPressed_    = false;
     moveLeftPressed_    = false;
     moveRightPressed_   = false;
+    
 
     isColliding_ = false;
     collDisZ_ = 0;

Modified: code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.h
===================================================================
--- code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.h	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBFigure.h	2018-05-24 13:03:43 UTC (rev 11987)
@@ -31,6 +31,7 @@
 
 #include "superorxobros/SOBPrereqs.h"
 #include "worldentities/ControllableEntity.h"
+#include "SOBTube.h"
 
 
 namespace orxonox
@@ -57,8 +58,12 @@
 
             //Soooo many declarations
             bool fireallowed_;
-
-            bool moveUpPressed_;
+            SOBTube*       tube; //class SOBTube* used because tube needs to be global using in collides against function and tick function in SOBfigure.cc
+            bool moveUpPressed_; 
+            int kkk;
+           
+            bool tcol_;  //used for getting through tube
+            bool tubing; //used for getting through tube 
             bool moveDownPressed_;
             bool moveLeftPressed_;
             bool moveRightPressed_;
@@ -67,6 +72,7 @@
             float timeSinceLastFire_;
             float lastSpeed_z;
             float firecooldown_;
+            float positiontube_;
             bool isColliding_;
             WorldEntity* particlespawner_;
             int PowerUpCounter_;

Modified: code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBGumba.cc
===================================================================
--- code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBGumba.cc	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBGumba.cc	2018-05-24 13:03:43 UTC (rev 11987)
@@ -105,7 +105,7 @@
     void SOBGumba::tick(float dt)
     {
         SUPER(SOBGumba, tick, dt);
-
+       
         if (!changeAllowed_) {
             changedOn_+= dt;
             // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions!

Modified: code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBItem.h
===================================================================
--- code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBItem.h	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBItem.h	2018-05-24 13:03:43 UTC (rev 11987)
@@ -48,7 +48,6 @@
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
             virtual void setFigure(SOBFigure* newFigure);
             virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
-
           
             bool attachedToFigure_;
 

Modified: code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBPrereqs.h
===================================================================
--- code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBPrereqs.h	2018-05-24 13:03:31 UTC (rev 11986)
+++ code/branches/SuperOrxoBros_FS18/src/modules/superorxobros/SOBPrereqs.h	2018-05-24 13:03:43 UTC (rev 11987)
@@ -79,6 +79,7 @@
     class SOBFlagstone;
     class SOBCastlestone;
     class SOBCoin;
+    class SOBTube;
 
 }
 



More information about the Orxonox-commit mailing list