[Orxonox-commit 5204] r9868 - in code/branches/invaders: data/levels data/levels/includes data/levels/templates data/overlays src/modules/invader src/orxonox/gametypes src/orxonox/worldentities

zifloria at orxonox.net zifloria at orxonox.net
Tue Dec 3 20:18:15 CET 2013


Author: zifloria
Date: 2013-12-03 20:18:15 +0100 (Tue, 03 Dec 2013)
New Revision: 9868

Modified:
   code/branches/invaders/data/levels/Invaders.oxw
   code/branches/invaders/data/levels/includes/invaderWeapon.oxi
   code/branches/invaders/data/levels/templates/enemyInvader.oxt
   code/branches/invaders/data/overlays/InvaderHUD.oxo
   code/branches/invaders/src/modules/invader/Invader.cc
   code/branches/invaders/src/modules/invader/Invader.h
   code/branches/invaders/src/modules/invader/InvaderCenterPoint.cc
   code/branches/invaders/src/modules/invader/InvaderCenterPoint.h
   code/branches/invaders/src/modules/invader/InvaderEnemy.cc
   code/branches/invaders/src/modules/invader/InvaderEnemy.h
   code/branches/invaders/src/modules/invader/InvaderHUDinfo.cc
   code/branches/invaders/src/modules/invader/InvaderHUDinfo.h
   code/branches/invaders/src/modules/invader/InvaderPrereqs.h
   code/branches/invaders/src/modules/invader/InvaderShip.cc
   code/branches/invaders/src/modules/invader/InvaderShip.h
   code/branches/invaders/src/modules/invader/InvaderWeapon.cc
   code/branches/invaders/src/modules/invader/InvaderWeapon.h
   code/branches/invaders/src/orxonox/gametypes/Gametype.cc
   code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc
Log:
End game screen. Eye candy. Gameplay tweaks

Modified: code/branches/invaders/data/levels/Invaders.oxw
===================================================================
--- code/branches/invaders/data/levels/Invaders.oxw	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/data/levels/Invaders.oxw	2013-12-03 19:18:15 UTC (rev 9868)
@@ -24,31 +24,17 @@
   </templates>
   <?lua include("includes/notifications.oxi") ?>
 
+    <!-- ambientlight = "0.8, 0.8, 0.8"
+    skybox       = "Orxonox/Starbox" -->
   <Scene
-    ambientlight = "0.8, 0.8, 0.8"
-    skybox       = "Orxonox/Starbox"
+    ambientlight = "0.8, 0.7, 0.4"
+    skybox     = "Orxonox/skyBoxBasic"
   >
 
-    <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="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="1100, 11000, -7000" lookat="0, 0, 0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
     <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=InvaderShip pawndesign=spaceshipinvader />
-    <MovableEntity
-      position = "-200,0,0"
-      velocity = "975.7, 0, 0"
-    >
-      <events>
-        <activity>
-          <EventListener event="start" />
-        </activity>
-      </events>
-      <attached>
 
-        <Model mass="1000" mesh="ast1.mesh" />
-      </attached>
-      <camerapositions>
-        <CameraPosition position="0,300,-100" direction="0, -1, 0" drag=false mouselook=true />
-      </camerapositions>
-    </MovableEntity>
-
     <DistanceTrigger name="start" position="-200,0,0" target="Pawn" distance=10 stayActive="true" delay=0 />
 
 

Modified: code/branches/invaders/data/levels/includes/invaderWeapon.oxi
===================================================================
--- code/branches/invaders/data/levels/includes/invaderWeapon.oxi	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/data/levels/includes/invaderWeapon.oxi	2013-12-03 19:18:15 UTC (rev 9868)
@@ -14,15 +14,9 @@
         </links>
         <Weapon>
           <InvaderWeapon mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" projectileMesh="laserbeam.mesh" />
-          <!--InvaderWeapon mode=0 munitionpershot=0 delay=0   
-
-          LaserBeam2
-
-            damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" projectileMesh="LaserBeam.mesh" /-->
         </Weapon>
         <Weapon>
           <InvaderWeapon mode=0 munitionpershot=0 delay=0     damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" projectileMesh="laserbeam.mesh" />
-          <!--InvaderWeapon mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" projectileMesh="LaserBeam.mesh" /-->
         </Weapon>
       </WeaponPack>
       <WeaponPack>

Modified: code/branches/invaders/data/levels/templates/enemyInvader.oxt
===================================================================
--- code/branches/invaders/data/levels/templates/enemyInvader.oxt	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/data/levels/templates/enemyInvader.oxt	2013-12-03 19:18:15 UTC (rev 9868)
@@ -6,13 +6,13 @@
    spawnparticleduration  = 3
    explosionchunks        = 4
 
-   health            = 100
-   maxhealth         = 100
-   initialhealth     = 100
+   health            = 10
+   maxhealth         = 10
+   initialhealth     = 10
 
-   shieldhealth        = 35
-   initialshieldhealth = 35
-   maxshieldhealth     = 60
+   shieldhealth        = 10
+   initialshieldhealth = 10
+   maxshieldhealth     = 10
    shieldabsorption    = 0.9
    reloadrate          = 1
    reloadwaittime      = 1

Modified: code/branches/invaders/data/overlays/InvaderHUD.oxo
===================================================================
--- code/branches/invaders/data/overlays/InvaderHUD.oxo	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/data/overlays/InvaderHUD.oxo	2013-12-03 19:18:15 UTC (rev 9868)
@@ -68,18 +68,8 @@
      showpoints     = true
     />
 
-
-    <OverlayText
-     position  = "0.4, 0.1"
-     pickpoint = "0.0, 0.0"
-     font      = "ShareTechMono"
-     textsize  = 0.04
-     colour    = "1.0, 1.0, 1.0, 1.0"
-     align     = "left"
-     caption   = "X"
-    />
     <InvaderHUDinfo
-     position  = "0.42, 0.1"
+     position  = "0.25, 0.1"
      pickpoint = "0.0, 0.0"
      font      = "ShareTechMono"
      textsize  = 0.04

Modified: code/branches/invaders/src/modules/invader/Invader.cc
===================================================================
--- code/branches/invaders/src/modules/invader/Invader.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/Invader.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -58,24 +58,24 @@
     {
         RegisterObject(Invader);
         this->center_ = 0;
-
-        this->console_addEnemy = createConsoleCommand( "spawnEnemy", createExecutor( createFunctor(&Invader::spawnEnemy, this) ) );
-        //this->context = context;
+        init();
         this->setHUDTemplate("InvaderHUD");
+    }
 
+    void Invader::init()
+    {
+        bEndGame = false;
         lives = 3;
+        // TODO:
         level = 1;
         point = 0;
         multiplier = 1;
         b_combo = false;
+        // spawn enemy every 2 seconds
         enemySpawnTimer.setTimer(2.0f, true, createExecutor(createFunctor(&Invader::spawnEnemy, this)));
         comboTimer.setTimer(2.5f, true, createExecutor(createFunctor(&Invader::comboControll, this)));
     }
 
-    Invader::~Invader()
-    {
-    }
-
     void Invader::spawnEnemy()
     {
         if (player == NULL)
@@ -93,6 +93,7 @@
             newPawn->addTemplate("enemyinvader");
             newPawn->setPlayer(player);
             newPawn->level = level;
+            // spawn enemy at random points in front of player.
             newPawn->setPosition(player->getPosition() + Vector3(500 + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
         }
     }
@@ -100,29 +101,25 @@
     void Invader::costLife()
     {
         lives--;
-        multiplier = 0;
-        if (lives <= 0) end();
+        multiplier = 1;
+        // end the game in 30 seconds.
+        if (lives <= 0)
+            enemySpawnTimer.setTimer(30.0f, false, createExecutor(createFunctor(&Invader::end, this)));
     };
 
     void Invader::comboControll()
     {
         if (b_combo)
             multiplier++;
+        // if no combo was performed before, reset multiplier
         else
             multiplier = 1;
         b_combo = false;
     }
 
-    // inject custom player controller
- /**   void Invader::spawnPlayer(PlayerInfo* player)
-    {
-        assert(player);
-
-        //player->startControl(new InvaderShip(this->center_->getContext() ) );
-    }*/
-
     void Invader::start()
     {
+        init();
         // Set variable to temporarily force the player to spawn.
         this->bForceSpawn_ = true;
 
@@ -136,10 +133,13 @@
         Deathmatch::start();
     }
 
+
     void Invader::end()
     {
-        orxout() << "STOP THE GAME, CHEATER!!!" << endl;
-        // Call end for the parent class.
-        // Deathmatch::end();
+        // DON'T CALL THIS!
+        //      Deathmatch::end();
+        // It will misteriously crash the game!
+        // Instead startMainMenu, this won't crash.
+        GSLevel::startMainMenu();
     }
 }

Modified: code/branches/invaders/src/modules/invader/Invader.h
===================================================================
--- code/branches/invaders/src/modules/invader/Invader.h	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/Invader.h	2013-12-03 19:18:15 UTC (rev 9868)
@@ -28,7 +28,7 @@
 
 /**
     @file Invader.h
-    @brief Declaration of the Invader class.
+    @brief Gametype.
     @ingroup Invader
 */
 
@@ -49,14 +49,11 @@
     class _InvaderExport Invader : public Deathmatch
     {
         public:
-            Invader(Context* context); //!< Constructor. Registers and initializes the object.
-            virtual ~Invader(); //!< Destructor. Cleans up, if initialized.
+            Invader(Context* context);
 
-            virtual void start(); //!< Starts the Invader minigame.
-            virtual void end(); ///!< Ends the Invader minigame.
+            virtual void start();
+            virtual void end();
 
-            //virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
-
             void spawnEnemy();
 
             void setCenterpoint(InvaderCenterPoint* center)
@@ -70,20 +67,22 @@
             void costLife();
             void levelUp(){level++;}
             void addPoints(int numPoints){point += numPoints * multiplier; b_combo = true;}
+            // checks if multiplier should be reset.
             void comboControll();
+            void init();
             int lives;
+            int multiplier;
+            bool bEndGame;
         private:
             WeakPtr<InvaderCenterPoint> center_;
             WeakPtr<InvaderShip> player;
 
-            ConsoleCommand* console_addEnemy;
             Timer enemySpawnTimer;
             Timer comboTimer;
             //Context* context;
             int level;
             int point;
             bool b_combo;
-            int multiplier;
     };
 }
 

Modified: code/branches/invaders/src/modules/invader/InvaderCenterPoint.cc
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderCenterPoint.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderCenterPoint.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -41,10 +41,6 @@
 {
     RegisterClass(InvaderCenterPoint);
 
-    /**
-    @brief
-        Constructor. Registers and initializes the object and checks whether the gametype is actually Invader.
-    */
     InvaderCenterPoint::InvaderCenterPoint(Context* context) : StaticEntity(context)
     {
         RegisterObject(InvaderCenterPoint);
@@ -52,22 +48,11 @@
         this->checkGametype();
     }
 
-    /**
-    @brief
-        Method to create a InvaderCenterPoint through XML.
-    */
     void InvaderCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(InvaderCenterPoint, XMLPort, xmlelement, mode);
-
-//        XMLPortParam(InvaderCenterPoint, "dimension", setFieldDimension, getFieldDimension, xmlelement, mode);
-
     }
 
-    /**
-    @brief
-        Is called when the gametype has changed.
-    */
     void InvaderCenterPoint::changedGametype()
     {
         SUPER(InvaderCenterPoint, changedGametype);
@@ -76,10 +61,6 @@
         this->checkGametype();
     }
 
-    /**
-    @brief
-        Checks whether the gametype is Invader and if it is, sets its centerpoint.
-    */
     void InvaderCenterPoint::checkGametype()
     {
         if (this->getGametype() != NULL && this->getGametype()->isA(Class(Invader)))

Modified: code/branches/invaders/src/modules/invader/InvaderCenterPoint.h
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderCenterPoint.h	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderCenterPoint.h	2013-12-03 19:18:15 UTC (rev 9868)
@@ -44,15 +44,13 @@
     class _InvaderExport InvaderCenterPoint : public StaticEntity
     {
         public:
-            InvaderCenterPoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Invader.
-            virtual ~InvaderCenterPoint() {}
+            InvaderCenterPoint(Context* context); //checks whether the gametype is actually Invader.
 
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a PongCenterpoint through XML.
-
             virtual void changedGametype(); //!< Is called when the gametype has changed.
         private:
-            void checkGametype(); //!< Checks whether the gametype is Pong and if it is, sets its centerpoint.
+            void checkGametype();
 
     };
 }

Modified: code/branches/invaders/src/modules/invader/InvaderEnemy.cc
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderEnemy.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderEnemy.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -49,17 +49,13 @@
     void InvaderEnemy::tick(float dt)
     {
         lifetime += dt;
+        // die after 5 seconds.
         if (lifetime > 5000)
-        {
             removeHealth(2000);
-        }
+
         if (player != NULL)
         {
             float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01, 2) + 1) * (player->getPosition().z - getPosition().z);
-            // if (newZ < 0)
-            //     newZ = (-100 < newZ)?-100:newZ;
-            // else
-            //     newZ = (100 > newZ)?100:newZ;
             setVelocity(Vector3(1000 - level * 100 , 0, newZ));
         }
         SUPER(InvaderEnemy, tick, dt);
@@ -67,8 +63,8 @@
 
     inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     {
-        // setVelocity(Vector3(1500,0,0));
-        removeHealth(2000);
+        if(orxonox_cast<Pawn*>(otherObject))
+            removeHealth(2000);
         return false;
     }
 
@@ -86,6 +82,6 @@
     {
         if (getGame())
             getGame()->addPoints(42);
-        // SUPER(InvaderEnemy, damage, damage, healthdamage, shielddamage, originator);
+        Pawn::damage(damage, healthdamage, shielddamage, originator);
     }
 }
\ No newline at end of file

Modified: code/branches/invaders/src/modules/invader/InvaderEnemy.h
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderEnemy.h	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderEnemy.h	2013-12-03 19:18:15 UTC (rev 9868)
@@ -44,7 +44,6 @@
     {
         public:
             InvaderEnemy(Context* context);
-            // virtual ~InvaderEnemy() {}
 
             virtual void tick(float dt);
             virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);

Modified: code/branches/invaders/src/modules/invader/InvaderHUDinfo.cc
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderHUDinfo.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderHUDinfo.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -46,10 +46,6 @@
         this->bShowMultiplier_ = false;
     }
 
-    InvaderHUDinfo::~InvaderHUDinfo()
-    {
-    }
-
     void InvaderHUDinfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(InvaderHUDinfo, XMLPort, xmlelement, mode);
@@ -74,22 +70,45 @@
             else if(this->bShowLevel_)
             {
                 const std::string& Level = multi_cast<std::string>(this->InvaderGame->getLevel());
-                this->setCaption(Level);
+                if (this->InvaderGame->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 press space.");
+                    setTextSize(0.05);
+                    this->InvaderGame->bEndGame = true;
+                }
+                else
+                {
+                    setTextSize(0.04);
+                    setPosition(Vector2(0.14, 0.055));
+                    this->setCaption(Level);
+                }
             }
             else if(this->bShowPoints_)
             {
                 const std::string& points = multi_cast<std::string>(this->InvaderGame->getPoints());
                 if (this->InvaderGame->lives <= 0)
                 {
-                    setTextSize(0.1);
-                    setPosition(Vector2(0.2, 0.5));
+                    setTextSize(0.2);
+                    setPosition(Vector2(0.1, 0.25));
+                    this->setCaption("Final score:\n" + points);
+                    this->setColour(ColourValue(1, 0, 0, 1));
                 }
-                this->setCaption(points);
+                else
+                {
+                    setTextSize(0.04);
+                    setPosition(Vector2(0.14, 0.1));
+                    this->setColour(ColourValue(1, 1, 1, 1));
+                    this->setCaption(points);
+                }
             }
             else if(this->bShowMultiplier_)
             {
-                const std::string& Multiplier = multi_cast<std::string>(this->InvaderGame->getMultiplier());
+                int mult = this->InvaderGame->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.01 + 0.04);
             }
         }
     }

Modified: code/branches/invaders/src/modules/invader/InvaderHUDinfo.h
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderHUDinfo.h	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderHUDinfo.h	2013-12-03 19:18:15 UTC (rev 9868)
@@ -38,7 +38,6 @@
     {
         public:
             InvaderHUDinfo(Context* context);
-            virtual ~InvaderHUDinfo();
 
             virtual void tick(float dt);
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);

Modified: code/branches/invaders/src/modules/invader/InvaderPrereqs.h
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderPrereqs.h	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderPrereqs.h	2013-12-03 19:18:15 UTC (rev 9868)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Reto Grieder
+ *      Florian Zinggeler
  *   Co-authors:
  *      ...
  *

Modified: code/branches/invaders/src/modules/invader/InvaderShip.cc
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderShip.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderShip.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -41,10 +41,6 @@
 {
     RegisterClass(InvaderShip);
 
-    /**
-    @brief
-        Constructor. Registers and initializes the object.
-    */
     InvaderShip::InvaderShip(Context* context) : SpaceShip(context)
     {
         RegisterObject(InvaderShip);
@@ -77,10 +73,10 @@
                 velocity.y = 0;
             if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)
                 velocity.x = 0;
-            // this->setVelocity(Vector3(1000 + velocity.y, 0, velocity.x));
             pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;
         }
 
+        // shoot!
         if (isFireing)
             ControllableEntity::fire(0);
 
@@ -90,19 +86,13 @@
         {
             camera->setPosition(Vector3(-pos.z, -posforeward, 0));
             camera->setOrientation(Vector3::UNIT_Z, Degree(90));
-            // orxout() << "asbhajskjasjahg" << pos << endl;
         }
 
 
 
         // bring back on track!
-        // if (pos.z > 42*2.5)
-        //     pos.z = 42*2.5;
-        // else if (pos.z < -42*3)
-        //     pos.z = -42*3;
         if(pos.y != 0)
             pos.y = 0;
-            
 
         setPosition(pos);
         setOrientation(Vector3::UNIT_Y, Degree(270));
@@ -121,12 +111,7 @@
     {
         lastTime = 0;
         if (getGame())
-        {
             getGame()->levelUp();
-            // SmartPtr<Invader> game = orxonox_cast<Invader>(getGametype());
-            
-        }
-        //level++
     }
 
     void InvaderShip::moveFrontBack(const Vector2& value)
@@ -143,26 +128,26 @@
     void InvaderShip::boost(bool bBoost)
     {
         isFireing = bBoost;
+        // restart if game ended
+        if (getGame())
+            if (getGame()->bEndGame)
+                getGame()->start();
     }
     inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     {
         // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
-
         WeakPtr<InvaderEnemy> enemy = orxonox_cast<InvaderEnemy*>(otherObject);
+        // ensure that this gets only called once per enemy.
         if (enemy != NULL && lastEnemy != enemy)
         {
             lastEnemy = enemy;
-            orxout() << "Enemy!!!! " << endl;
+
             removeHealth(20);
-            if (getHealth() <= 0)
+            if (getGame())
             {
-                orxout() << "DIED!!!! " << endl;
-                if (getGame())
-                {
-                    getGame()->costLife();
-                    // SmartPtr<Invader> game = orxonox_cast<Invader>(getGametype());
-                    
-                }
+                getGame()->multiplier = 1;
+                if (getHealth() <= 0)
+                    getGame()->costLife();                    
             }
             return false;
         }

Modified: code/branches/invaders/src/modules/invader/InvaderShip.h
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderShip.h	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderShip.h	2013-12-03 19:18:15 UTC (rev 9868)
@@ -44,27 +44,27 @@
     class _InvaderExport InvaderShip : public SpaceShip
     {
         public:
-            InvaderShip(Context* context); //!< Constructor. Registers and initializes the object.
-            virtual ~InvaderShip() {}
+            InvaderShip(Context* context);
 
             virtual void tick(float dt);
 
+            // overwrite for 2d movement
             virtual void moveFrontBack(const Vector2& value);
             virtual void moveRightLeft(const Vector2& value);
 
-            virtual void boost(bool bBoost); // Starts or stops fireing
+            // Starts or stops fireing
+            virtual void boost(bool bBoost);
 
             //no rotation!
             virtual void rotateYaw(const Vector2& value){}; 
             virtual void rotatePitch(const Vector2& value){};
-            virtual void rotateRoll(const Vector2& value){};
+            //return to main menu if game has ended.
+            virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
 
             virtual void updateLevel();
 
-            // *InvaderShip getShip(){return this;}
             virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
         private:
-
             WeakPtr<Invader> getGame();
             WeakPtr<Invader> game;
             Camera* camera;

Modified: code/branches/invaders/src/modules/invader/InvaderWeapon.cc
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderWeapon.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderWeapon.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -60,8 +60,6 @@
 
     void InvaderWeapon::shot()
     {
-        // orxout(internal_error) << "shotttttt" << endl;
-
         assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
 
         // Create the projectile.
@@ -73,9 +71,11 @@
         model->setScale(5);
 
         this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
-        projectile->setOrientation(Quaternion(sqrt(0.5),0,sqrt(0.5),0)); //this->getMuzzleOrientation()   Quaternion::IDENTITY
+        // only shoot in foreward direction
+        projectile->setOrientation(Quaternion(sqrt(0.5),0,sqrt(0.5),0));
         projectile->setPosition(this->getMuzzlePosition());
-        projectile->setVelocity(Vector3(1, 0, 0) * 2000); //this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity() + this->getMuzzleDirection() * this->speed_
+        // only shoot in foreward direction
+        projectile->setVelocity(Vector3(1, 0, 0) * 2000);
 
         projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
         projectile->setDamage(this->getDamage());

Modified: code/branches/invaders/src/modules/invader/InvaderWeapon.h
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderWeapon.h	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/modules/invader/InvaderWeapon.h	2013-12-03 19:18:15 UTC (rev 9868)
@@ -41,14 +41,6 @@
 
 namespace orxonox
 {
-
-    /**
-    @brief
-        Shoots laser beams.
-    @author
-        Hagen Seifert
-    @ingroup WeaponsHsW01s
-    */
     class _InvaderExport InvaderWeapon : public HsW01
     {
         public:

Modified: code/branches/invaders/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/branches/invaders/src/orxonox/gametypes/Gametype.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/orxonox/gametypes/Gametype.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -170,7 +170,6 @@
                     entity->setPosition(oldentity->getWorldPosition());
                     entity->setOrientation(oldentity->getWorldOrientation());
                 }
-
                 it->first->startControl(entity);
             }
             else

Modified: code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc
===================================================================
--- code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc	2013-12-02 19:12:22 UTC (rev 9867)
+++ code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc	2013-12-03 19:18:15 UTC (rev 9868)
@@ -147,6 +147,8 @@
         this->debrisEntity3_->attach(debris3_);
         this->debrisEntity4_->attach(debris4_);
 
+        // particleSpawner is a static entity. It should probably be dynamic, for better explosions.
+        // effect->SetVelocity(this->getVelocity() + Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100))
         ParticleSpawner* effect = new ParticleSpawner(this->getContext());
         effect->setDestroyAfterLife(true);
         effect->setSource("Orxonox/explosion2b");




More information about the Orxonox-commit mailing list