[Orxonox-commit 6979] r11600 - in code/branches/FlappyOrx_HS17: data/levels data/levels/templates data/overlays src/modules/flappyorx

merholzl at orxonox.net merholzl at orxonox.net
Mon Nov 27 15:29:03 CET 2017


Author: merholzl
Date: 2017-11-27 15:29:03 +0100 (Mon, 27 Nov 2017)
New Revision: 11600

Modified:
   code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw
   code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt
   code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo
   code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
   code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
   code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
   code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h
Log:
XML Ports and cleanUp

Modified: code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw
===================================================================
--- code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw	2017-11-27 14:28:41 UTC (rev 11599)
+++ code/branches/FlappyOrx_HS17/data/levels/FlappyOrx.oxw	2017-11-27 14:29:03 UTC (rev 11600)
@@ -4,8 +4,11 @@
  tags = "minigame"
  screenshot = "orxonoxArcade.png"
 />
-
+<FlappyOrx
+      spawnDistance=50 
+      Speed = 700 />
 <?lua
+  include("includes/notifications.oxi")
   include("templates/lodInformation.oxt")
   include("templates/spaceshipFlappyOrx.oxt")
   include("overlays/FlappyOrxHUD.oxo")
@@ -36,6 +39,8 @@
     
     <FlappyOrxCenterPoint name=flappyorxcenter />
     
+    
+
     <?lua
       for i = 1, 5, 1 do
         for j = 3, 12,3 do

Modified: code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt
===================================================================
--- code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt	2017-11-27 14:28:41 UTC (rev 11599)
+++ code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt	2017-11-27 14:29:03 UTC (rev 11600)
@@ -21,9 +21,9 @@
     collisiondamage = 100
     enablecollisiondamage = true
 
-    speed = 100
+    
     UpwardThrust = 200
-    gravity = 500
+    Gravity = 700
   >
     <engines>
       <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipFlappyOrxengine />
@@ -36,7 +36,7 @@
     <collisionShapes>
       <SphereCollisionShape position="-1.8    ,0 ,  -11" radius="15" />
       <SphereCollisionShape position="-0.8   ,0 ,  0" radius="16" />
-      <SphereCollisionShape position="0   ,0 ,  11" radius="12.5" />
+      <!-- <SphereCollisionShape position="0   ,0 ,  11" radius="12.5" /> -->
     </collisionShapes>
   
   </FlappyOrxShip>

Modified: code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo
===================================================================
--- code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo	2017-11-27 14:28:41 UTC (rev 11599)
+++ code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo	2017-11-27 14:29:03 UTC (rev 11600)
@@ -1,3 +1,5 @@
+
+
 <Template name="FlappyOrxHUD">
   <OverlayGroup name="FlappyOrxHUD" scale = "1, 1">
    

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	2017-11-27 14:28:41 UTC (rev 11599)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	2017-11-27 14:29:03 UTC (rev 11600)
@@ -36,7 +36,7 @@
 #include "core/EventIncludes.h"
 #include "core/command/Executor.h"
 #include "core/config/ConfigValueIncludes.h"
-
+#include "core/XMLPort.h"
 #include "gamestates/GSLevel.h"
 #include "chat/ChatManager.h"
 
@@ -62,15 +62,21 @@
         point = 0;                          //number of cleared tubes
         bIsDead = true;
         firstGame = true;                   //needed for the HUD
-
-        spawnDistance=200;                  //distance between tubes
+        speed = 0;
+        spawnDistance=300;                  //distance between tubes
         tubeOffsetX=500;                    //tube offset (so that we can't see them spawn)
 
         circlesUsed=0;
         setHUDTemplate("FlappyOrxHUD");
     }
+    
+    void FlappyOrx::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+        {   
+            SUPER(FlappyOrx, XMLPort, xmlelement, mode);
+            XMLPortParam(FlappyOrx, "spawnDistance", setspawnDistance, getspawnDistance, xmlelement, mode);
+            XMLPortParam(FlappyOrx, "Speed", setSpeed, getSpeed, xmlelement, mode);
+        }
 
-
     void FlappyOrx::updatePlayerPos(int x){
 
         //Spawn a new Tube when the spawn distance is reached
@@ -94,8 +100,8 @@
     //Gets called when we pass through a Tube
     void FlappyOrx::levelUp(){
         point++;
-        spawnDistance = 300-3*point;            //smaller spawn Distance
-        getPlayer()->setSpeed(100+.5*point);    //increase speed
+        spawnDistance = spawnDistance-3*point;            //smaller spawn Distance
+        getPlayer()->setSpeed(this->speed+.5*point);    //increase speed
     }
 
     //Returns our Ship

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	2017-11-27 14:28:41 UTC (rev 11599)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	2017-11-27 14:29:03 UTC (rev 11600)
@@ -66,6 +66,17 @@
             virtual void end() override;
             virtual void death();
             virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            
+            void setspawnDistance( int spawnDistance)
+                {this->spawnDistance = spawnDistance; }
+            int getspawnDistance()
+                { return this->spawnDistance; }  
+            inline void setSpeed( float speed ){   
+                orxout()<< speed<< endl;
+                this->speed = speed; }
+            inline float getSpeed( )
+                { return this->speed; }
 
             void updatePlayerPos(int x);
             void createAsteroid(Circle &c);
@@ -73,7 +84,7 @@
             void spawnTube();
             
             void setCenterpoint(FlappyOrxCenterPoint* center);
-
+           
             int getPoints(){return this->point;}
             
             void levelUp();
@@ -91,6 +102,7 @@
             std::queue<MovableEntity*> asteroids;
             int spawnDistance;
             int tubeOffsetX;
+            float speed = 100;
             
         private:
              

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	2017-11-27 14:28:41 UTC (rev 11599)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	2017-11-27 14:29:03 UTC (rev 11600)
@@ -57,13 +57,12 @@
         
     }
 
-    
     void FlappyOrxShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
         {   
             SUPER(FlappyOrxShip, XMLPort, xmlelement, mode);
-            XMLPortParam(FlappyOrxShip, "speed", setSpeed, getSpeed, xmlelement, mode);
+            XMLPortParam(FlappyOrxShip, "Speed", setSpeed, getSpeed, xmlelement, mode);
             XMLPortParam(FlappyOrxShip, "UpwardThrust", setUpwardThrust, getUpwardThrust, xmlelement, mode);
-            XMLPortParam(FlappyOrxShip, "gravity", setGravity, getGravity, xmlelement, mode);
+            XMLPortParam(FlappyOrxShip, "Gravity", setGravity, getGravity, xmlelement, mode);
     }
 
     void FlappyOrxShip::tick(float dt)
@@ -116,12 +115,6 @@
         }
     }
 
-    void FlappyOrxShip::updateLevel()
-    {
-        if (getGame())
-            getGame()->levelUp();
-    }
-
     int FlappyOrxShip::timeUntilRespawn(){
         return 2-time(0)+deathTime;
     }
@@ -136,12 +129,12 @@
         isFlapping=boost;
     }
 
-    void FlappyOrxShip::rotateRoll(const Vector2& value)
-    {
-        if (getGame())
-            if (getGame()->bEndGame)
-                getGame()->end();
-    }
+    // void FlappyOrxShip::rotateRoll(const Vector2& value)
+    // {
+    //     if (getGame())
+    //         if (getGame()->bEndGame)
+    //             getGame()->end();
+    // }
 
     FlappyOrx* FlappyOrxShip::getGame()
     {

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h	2017-11-27 14:28:41 UTC (rev 11599)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.h	2017-11-27 14:29:03 UTC (rev 11600)
@@ -48,10 +48,7 @@
 
             virtual void tick(float dt) override;
 
-            // overwrite for 2d movement
-            virtual void moveFrontBack(const Vector2& value) override;
-            virtual void moveRightLeft(const Vector2& value) override;
-
+            
             // Starts or stops fireing
             virtual void boost(bool bBoost) override;
 
@@ -59,9 +56,11 @@
             virtual void rotateYaw(const Vector2& value) override{}; 
             virtual void rotatePitch(const Vector2& value) override{};
             //return to main menu if game has ended.
-            virtual void rotateRoll(const Vector2& value) override;
-            inline void setSpeed( float speed )
-                { orxout() << "speed set: " << speed << endl; this->speed = speed; }
+            //virtual void rotateRoll(const Vector2& value) override;
+            
+            inline void setSpeed( float speed ){   
+                orxout()<< speed<< endl;
+                this->speed = speed; }
             inline float getSpeed( )
                 { return this->speed; }
             inline void setGravity( float gravity )
@@ -72,7 +71,7 @@
                 { this->UpwardThrust = UpwardThrust; }
             inline float getUpwardThrust()
                 { return this->UpwardThrust; }
-            virtual void updateLevel();
+   
             virtual int timeUntilRespawn();
             
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);



More information about the Orxonox-commit mailing list