[Orxonox-commit 7799] r12391 - in code/branches/OrxoBlox_FS19: data/levels src/modules/OrxoBlox src/modules/asteroids2D

jeromela at orxonox.net jeromela at orxonox.net
Thu May 16 16:57:28 CEST 2019


Author: jeromela
Date: 2019-05-16 16:57:28 +0200 (Thu, 16 May 2019)
New Revision: 12391

Modified:
   code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.cc
   code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.h
   code/branches/OrxoBlox_FS19/src/modules/asteroids2D/Asteroids2DShip.cc
Log:
Zielvisier eingefuegt

Modified: code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw
===================================================================
--- code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw	2019-05-16 14:53:45 UTC (rev 12390)
+++ code/branches/OrxoBlox_FS19/data/levels/orxoblox.oxw	2019-05-16 14:57:28 UTC (rev 12391)
@@ -15,6 +15,7 @@
   include("templates/spaceshipAssff2.oxt")
   include("templates/spaceshipPirate.oxt")
   include("templates/spaceshipOrxoBlox.oxt")
+  include("templates/spaceshipEscort.oxt")
 ?>
 
 <!--Template name=OrxoBloxbatcameras defaults=0>
@@ -85,8 +86,10 @@
   >
     <!-- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> -->
     <Light type=directional position="-100, 10000, -700" direction="0.2, -1, 0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
-    <SpawnPoint team=0 position="0,-4.5,49" lookat="0,0,0" spawnclass= OrxoBloxShip pawndesign=spaceshipOrxoBlox/>
+    <SpawnPoint team=0 position="0,-4.5,49" lookat="0,0,0" spawnclass= SpaceShip pawndesign=spaceshipOrxoBlox/>
 
+    <!--SpawnPoint team=0 position="0,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort /--->
+
     <!--<Model mesh="axes.mesh" scale=10 position="0,0,0" /> -->
 
 

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-16 14:53:45 UTC (rev 12390)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.cc	2019-05-16 14:57:28 UTC (rev 12391)
@@ -331,6 +331,10 @@
         this->player_ = player;
     }
     
+    void OrxoBlox::tick(float dt)
+    {        
+        SUPER(OrxoBlox, tick, dt);
+    }
 /*
     bool OrxoBlox::Intersect(int XpositionBall, int XPositionBlock, int YPositionBall, int YPositionBlock, int radiusBall, int sizeBlock) {
         distanceX = XpositionBall - XPositionBlock;

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-05-16 14:53:45 UTC (rev 12390)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h	2019-05-16 14:57:28 UTC (rev 12391)
@@ -75,8 +75,8 @@
             PlayerInfo* getPlayer();
             // void spawnPlayer(PlayerInfo* Player) override;
             virtual void playerPreSpawn(PlayerInfo* player) override;
+            virtual void tick(float dt) override;
 
-
             void LevelUp();
 
             /**

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.cc	2019-05-16 14:53:45 UTC (rev 12390)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.cc	2019-05-16 14:57:28 UTC (rev 12391)
@@ -68,9 +68,24 @@
 
     void OrxoBloxShip::tick(float dt)
     {
-        SUPER(OrxoBloxShip, tick, dt);
         Vector3 pos = this->getPosition();
+
+        //ensure that the ship stays in playing field
+        if(pos.x > width/2)   pos.x = -width/2;
+        if(pos.x < -width/2)  pos.x = width/2;
+        if(pos.z > height/2)  pos.z = -height/2;
+        if(pos.z < -height/2) pos.z = height/2;
+
+        //2D movement, position should always = 0 on y-axis
+        if(pos.y!=0) pos.y = 0;
         this->setPosition(pos);
+
+
+        //if you hit an asteroid, the ship will turn -> you need to reorientate the ship 
+        Quaternion ort = this->getOrientation();
+        ort.x = 0;
+        ort.z = 0;
+        this->setOrientation(ort);
     }   
 
     void OrxoBloxShip::boost(bool bBoost)

Modified: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.h
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.h	2019-05-16 14:53:45 UTC (rev 12390)
+++ code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.h	2019-05-16 14:57:28 UTC (rev 12391)
@@ -52,9 +52,11 @@
             //no rotation in x and z direction!
             //virtual void rotatePitch(const Vector2& value) override{}; // Rotate in pitch direction.
             //Yaw
+            virtual void rotatePitch(const Vector2& value) override{}; // Rotate in pitch direction.
             virtual void rotateRoll(const Vector2& value) override{}; // Rotate in roll direction.
             virtual void boost(bool boost) override; //Override, so that the ship does not shake
             
+            
             /*Functions that can be helpful while debugging.
                 - Set a timer so that the function is called for instance every 3s to display the coordinates
                 - Open console with "~`"-key in when you start the Asteroids2D - Minigame.
@@ -68,7 +70,7 @@
                 bImmune = !bImmune;
             }
 
-        protected:
+        //protected:
         private:
             OrxoBlox* getGame();
 

Modified: code/branches/OrxoBlox_FS19/src/modules/asteroids2D/Asteroids2DShip.cc
===================================================================
--- code/branches/OrxoBlox_FS19/src/modules/asteroids2D/Asteroids2DShip.cc	2019-05-16 14:53:45 UTC (rev 12390)
+++ code/branches/OrxoBlox_FS19/src/modules/asteroids2D/Asteroids2DShip.cc	2019-05-16 14:57:28 UTC (rev 12391)
@@ -68,7 +68,7 @@
 
     void Asteroids2DShip::tick(float dt)
     {
-        SUPER(Asteroids2DShip, tick, dt);
+        //SUPER(Asteroids2DShip, tick, dt);
         Vector3 pos = this->getPosition();
 
         //ensure that the ship stays in playing field



More information about the Orxonox-commit mailing list