[Orxonox-commit 6922] r11543 - in code/branches/FlappyOrx_HS17: data/levels/templates src/modules/flappyorx

pascscha at orxonox.net pascscha at orxonox.net
Mon Nov 6 16:18:12 CET 2017


Author: pascscha
Date: 2017-11-06 16:18:11 +0100 (Mon, 06 Nov 2017)
New Revision: 11543

Modified:
   code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt
   code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
Log:
camera changes

Modified: code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt
===================================================================
--- code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt	2017-11-06 15:10:49 UTC (rev 11542)
+++ code/branches/FlappyOrx_HS17/data/levels/templates/spaceshipFlappyOrx.oxt	2017-11-06 15:18:11 UTC (rev 11543)
@@ -85,7 +85,7 @@
 <!--       <CameraPosition position="0,15, 60" drag=true mouselook=true />
       <CameraPosition position="0,20, 90" drag=true mouselook=true />
       <CameraPosition position="0,30,120" drag=true mouselook=true /> -->
-      <CameraPosition position="0,300,-100" direction="0, -1, 0" drag=false mouselook=true />
+      <CameraPosition position="0,300,-100" direction="0, -1, 0" drag=false absolute=true mouselook=true />
     </camerapositions>
   </FlappyOrxShip>
 </Template>

Modified: code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc
===================================================================
--- code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	2017-11-06 15:10:49 UTC (rev 11542)
+++ code/branches/FlappyOrx_HS17/src/modules/flappyorx/FlappyOrxShip.cc	2017-11-06 15:18:11 UTC (rev 11543)
@@ -68,9 +68,9 @@
         if (this->hasLocalController())
         {
             if(getHealth()<0){
-                 getGame()->costLife();
-                 getGame()->death();
-                 death();
+                setHealth(1);
+                getGame()->death();
+                death();   
             }
             Vector3 pos = getPosition();
 
@@ -86,31 +86,26 @@
 
             pos += Vector3(speed + velocity.x, 0, velocity.y) * dt;
             
-            if(pos.z > 150){
-                pos.z=0;
-                velocity.y = 0;
-            }
+
             
-            // restart if game ended
-            if (getGame())
-                if (getGame()->bEndGame)
-                {
-                    getGame()->start();
-                    return;
-                }
-            
-            
             // Camera
             Camera* camera = this->getCamera();
             if (camera != nullptr)
             {
-                camera->setPosition(Vector3(-pos.z, -pos.y, 0));
-                camera->setOrientation(Vector3::UNIT_Z, Degree(90));
+                //camera->setPosition(Vector3(-pos.z, -pos.y, 0));
+                camera->setPosition(pos.x,-100,0);
+                camera->setOrientation(Vector3::UNIT_Z, Degree(0));
+
             }
 
             
             setPosition(pos);
-            setOrientation(Vector3::UNIT_Y, Degree(270));
+            setOrientation(Vector3::UNIT_Y, Degree(270-velocity.y/10));
+
+            if(pos.z > 150){
+                getGame()->death();
+                death();
+            }
             
         }
     }
@@ -153,6 +148,10 @@
     {
         Vector3 pos = getPosition();
         pos.x = 0;
+        pos.z = 0;
+        pos.y = 0;
+        velocity.y = 0;
         setPosition(pos);
+        usleep(1000u);
     }
 }



More information about the Orxonox-commit mailing list