[Orxonox-commit 6912] r11533 - in code/branches/FlappyOrx_HS17: data/overlays src/modules/flappyorx

merholzl at orxonox.net merholzl at orxonox.net
Mon Nov 6 14:12:58 CET 2017


Author: merholzl
Date: 2017-11-06 14:12:57 +0100 (Mon, 06 Nov 2017)
New Revision: 11533

Modified:
   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/FlappyOrxHUDinfo.cc
Log:
point system in place

Modified: code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo
===================================================================
--- code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo	2017-11-06 12:41:07 UTC (rev 11532)
+++ code/branches/FlappyOrx_HS17/data/overlays/FlappyOrxHUD.oxo	2017-11-06 13:12:57 UTC (rev 11533)
@@ -5,8 +5,9 @@
 
 <Template name="FlappyOrxHUD">
   <OverlayGroup name="FlappyOrxHUD" scale = "1, 1">
+   
     <FlappyOrxHUDinfo
-     position  = "0.14, 0.02"
+     position  = "0.02, 0.01"
      pickpoint = "0.0, 0.0"
      font      = "ShareTechMono"
      textsize  = 0.04
@@ -13,10 +14,10 @@
      colour    = "1.0, 1.0, 1.0, 1.0"
      align     = "left"
 
-     showlives     = true
-     showlevel     = false
-     showpoints     = false
+     showlives     = false
+     showpoints     = true
     />
+
     <OverlayText
      position  = "0.02, 0.02"
      pickpoint = "0.0, 0.0"
@@ -24,90 +25,28 @@
      textsize  = 0.04
      colour    = "1.0, 1.0, 1.0, 1.0"
      align     = "left"
-     caption   = "Lives:   "
+     caption   = "Points: "
     />
-
-    <OverlayText
-     position  = "0.02, 0.055"
+    <!-- <FlappyOrxHUDinfo 
+     position  = "0.14, 0.01"
      pickpoint = "0.0, 0.0"
      font      = "ShareTechMono"
      textsize  = 0.04
      colour    = "1.0, 1.0, 1.0, 1.0"
      align     = "left"
-     caption   = "Level: "
-    />
 
-    <FlappyOrxHUDinfo
-     position  = "0.14, 0.055"
-     pickpoint = "0.0, 0.0"
-     font      = "ShareTechMono"
-     textsize  = 0.04
-     colour    = "1.0, 1.0, 1.0, 1.0"
-     align     = "left"
-
-     showlives     = false
-     showlevel     = true
+     showlives     = true
      showpoints     = false
     />
 
     <OverlayText
-     position  = "0.02, 0.1"
+     position  = "0.14, 0.02"
      pickpoint = "0.0, 0.0"
      font      = "ShareTechMono"
      textsize  = 0.04
      colour    = "1.0, 1.0, 1.0, 1.0"
      align     = "left"
-     caption   = "Points: "
-    />
-
-    <FlappyOrxHUDinfo
-     position  = "0.14, 0.1"
-     pickpoint = "0.0, 0.0"
-     font      = "ShareTechMono"
-     textsize  = 0.04
-     colour    = "1.0, 1.0, 1.0, 1.0"
-     align     = "left"
-
-     showlives     = false
-     showlevel     = false
-     showpoints     = true
-    />
-
-    <FlappyOrxHUDinfo
-     position  = "0.25, 0.1"
-     pickpoint = "0.0, 0.0"
-     font      = "ShareTechMono"
-     textsize  = 0.04
-     colour    = "1.0, 1.0, 1.0, 1.0"
-     align     = "left"
-
-     showMultiplier = true
-    />
+     caption   = "Lives: "
+    /> -->
   </OverlayGroup>
 </Template>
-
-
-<Template name="spaceshiphud">
-  <OverlayGroup name = "spaceshiphud" scale = "1, 1">
-    <HUDHealthBar
-     name              = "HealthBar1"
-     background        = "Orxonox/HealthBarBackground"
-     size              = "0.35, 0.0875"
-     position          = "0.0 , 0.9 "
-     pickpoint         = "0, 1"
-     bartexture        = "healthbar_bar.png"
-     textfont          = "VeraMono"
-     textusebarcolour  = true
-     textscale          = 0.4
-     textoffset        = "0.325, -0.825"
-     textpickpoint     = "0, 0"
-     textalign         = "right"
-     correctaspect     = true
-     iconmaterial      = "Orxonox/BarIconHealth"
-    >
-      <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
-      <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
-      <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
-    </HUDHealthBar>
- </OverlayGroup>
-</Template>
\ No newline at end of file

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	2017-11-06 12:41:07 UTC (rev 11532)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.cc	2017-11-06 13:12:57 UTC (rev 11533)
@@ -62,7 +62,7 @@
         this->center_ = nullptr;
         bEndGame = false;
         lives = 1;
-        level = 1;
+        level = 0;
         point = 0;
         bShowLevel = false;
         multiplier = 1;
@@ -80,6 +80,7 @@
         if(this->tubes.size()!=0&&x>this->tubes.front()){
             this->tubes.pop();
             levelUp();
+            point++;
         }
     }
 
@@ -86,7 +87,7 @@
     void FlappyOrx::levelUp()
     {
         level++;
-        //toggleShowLevel();
+        toggleShowLevel();
         //showLevelTimer.setTimer(3.0f, false, createExecutor(createFunctor(&FlappyOrx::toggleShowLevel, this)));
     }
 

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	2017-11-06 12:41:07 UTC (rev 11532)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrx.h	2017-11-06 13:12:57 UTC (rev 11533)
@@ -95,7 +95,7 @@
             int tubeOffsetX;
         private:
             void toggleShowLevel(){bShowLevel = !bShowLevel;}
-
+            
             const static int nAst = 7;
             Circle Asteroids[nAst];
 

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc	2017-11-06 12:41:07 UTC (rev 11532)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxHUDinfo.cc	2017-11-06 13:12:57 UTC (rev 11533)
@@ -41,7 +41,7 @@
 
         this->FlappyOrxGame = nullptr;
         this->bShowLives_ = false;
-        this->bShowLevel_ = false;
+        this->bShowLevel_ = true;
         this->bShowPoints_ = false;
         this->bShowMultiplier_ = false;
     }
@@ -50,10 +50,10 @@
     {
         SUPER(FlappyOrxHUDinfo, XMLPort, xmlelement, mode);
 
-        // XMLPortParam(FlappyOrxHUDinfo, "showlives",     setShowLives,     getShowLives,     xmlelement, mode).defaultValues(false);
-         XMLPortParam(FlappyOrxHUDinfo, "showPoints",     setShowPoints,     getShowPoints,     xmlelement, mode).defaultValues(false);
-        // XMLPortParam(FlappyOrxHUDinfo, "showLevel",     setShowLevel,     getShowLevel,     xmlelement, mode).defaultValues(false);
-        // XMLPortParam(FlappyOrxHUDinfo, "showMultiplier",     setShowMultiplier,     getShowMultiplier,     xmlelement, mode).defaultValues(false);
+        XMLPortParam(FlappyOrxHUDinfo, "showlives",     setShowLives,     getShowLives,     xmlelement, mode).defaultValues(false);
+        XMLPortParam(FlappyOrxHUDinfo, "showPoints",     setShowPoints,     getShowPoints,     xmlelement, mode).defaultValues(false);
+       
+    
     }
 
     void FlappyOrxHUDinfo::tick(float dt)
@@ -62,36 +62,11 @@
 
         if (this->FlappyOrxGame)
         {
-            // if (this->bShowLives_)
+            // if (this->bShowLives_)  //preperation for easy mode
             // {
-            //     const std::string& lives = multi_cast<std::string>(this->FlappyOrxGame->getLives());
+            //     const std::string& lives = multi_cast<std::string>(this->InvaderGame->getLives());
             //     this->setCaption(lives);
             // }
-            // else if(this->bShowLevel_)
-            // {
-            //     const std::string& Level = multi_cast<std::string>(this->FlappyOrxGame->getLevel());
-            //     if (this->FlappyOrxGame->lives <= 0)
-            //     {
-            //         setPosition(Vector2(0.1, 0.65));
-            //         this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!");
-            //         setTextSize(0.05);
-            //         this->FlappyOrxGame->bEndGame = true;
-            //     }
-            //     else if (this->FlappyOrxGame->bShowLevel)
-            //     {
-            //         setTextSize(0.1);
-            //         setPosition(Vector2(0.3, 0.55));
-            //         std::stringstream sstm;
-            //         sstm << "Level " << Level;
-            //         this->setCaption(sstm.str()); // + level
-            //     }
-            //     else
-            //     {
-            //         setTextSize(0.04);
-            //         setPosition(Vector2(0.14, 0.055));
-            //         this->setCaption(Level);
-            //     }
-            // }
             if(this->bShowPoints_)
             {
                 const std::string& points = multi_cast<std::string>(this->FlappyOrxGame->getPoints());
@@ -98,7 +73,7 @@
                 if (this->FlappyOrxGame->lives <= 0)
                 {
                     setTextSize(0.2);
-                    setPosition(Vector2(0.1, 0.25));
+                    setPosition(Vector2(0.1, 0.02));
                     this->setCaption("Final score:\n" + points);
                     this->setColour(ColourValue(1, 0, 0, 1));
                 }
@@ -105,19 +80,12 @@
                 else
                 {
                     setTextSize(0.04);
-                    setPosition(Vector2(0.14, 0.1));
+                    setPosition(Vector2(0.14, 0.02));
                     this->setColour(ColourValue(1, 1, 1, 1));
                     this->setCaption(points);
                 }
             }
-            // else if(this->bShowMultiplier_)
-            // {
-            //     int mult = this->FlappyOrxGame->getMultiplier();
-            //     const std::string& Multiplier = "X " + multi_cast<std::string>(mult);
-            //     this->setCaption(Multiplier);
-            //     this->setColour(ColourValue(1, 0, 0, clamp(float(mult * 0.1), 0.0f, 1.0f)));
-            //     this->setTextSize(clamp(float(mult * 0.1), 0.0f, 1.0f) * 0.01f + 0.04f);
-            // }
+           
         }
     }
 



More information about the Orxonox-commit mailing list