[Orxonox-commit 5216] r9879 - in code/branches/invaders/src: modules/invader orxonox/worldentities orxonox/worldentities/pawns

zifloria at orxonox.net zifloria at orxonox.net
Mon Dec 9 14:08:26 CET 2013


Author: zifloria
Date: 2013-12-09 14:08:26 +0100 (Mon, 09 Dec 2013)
New Revision: 9879

Modified:
   code/branches/invaders/src/modules/invader/Invader.cc
   code/branches/invaders/src/modules/invader/InvaderWeaponEnemy.cc
   code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc
   code/branches/invaders/src/orxonox/worldentities/BigExplosion.h
   code/branches/invaders/src/orxonox/worldentities/pawns/Pawn.cc
Log:
tweaking + still trying to figure out explosions

Modified: code/branches/invaders/src/modules/invader/Invader.cc
===================================================================
--- code/branches/invaders/src/modules/invader/Invader.cc	2013-12-09 13:07:55 UTC (rev 9878)
+++ code/branches/invaders/src/modules/invader/Invader.cc	2013-12-09 13:08:26 UTC (rev 9879)
@@ -68,7 +68,6 @@
     {
         bEndGame = false;
         lives = 3;
-        // TODO:
         level = 1;
         point = 0;
         bShowLevel = false;
@@ -113,7 +112,7 @@
         if (getPlayer() == NULL)
             return;
         srand(player->getPosition().x + player->getPosition().y);
-        for (int i = 0; i < (3*log(level) + 1); i++)
+        for (int i = 0; i < (3*log10(level) + 1); i++)
         {
             WeakPtr<InvaderEnemy> newPawn;
             if (rand() % 42/(1 + level*level) == 0)

Modified: code/branches/invaders/src/modules/invader/InvaderWeaponEnemy.cc
===================================================================
--- code/branches/invaders/src/modules/invader/InvaderWeaponEnemy.cc	2013-12-09 13:07:55 UTC (rev 9878)
+++ code/branches/invaders/src/modules/invader/InvaderWeaponEnemy.cc	2013-12-09 13:08:26 UTC (rev 9879)
@@ -47,7 +47,7 @@
     	InvaderWeapon::shot();
         // SUPER(InvaderWeaponEnemy, shot);
         // only shoot in foreward direction
-        projectile->setVelocity(Vector3(1, 0, 0) * -500);
+        projectile->setVelocity(Vector3(1, 0, 0) * 300);
         // projectile->setOrientation(Quaternion(sqrt(0.5),0,sqrt(0.5),0));
     }
 }

Modified: code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc
===================================================================
--- code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc	2013-12-09 13:07:55 UTC (rev 9878)
+++ code/branches/invaders/src/orxonox/worldentities/BigExplosion.cc	2013-12-09 13:08:26 UTC (rev 9879)
@@ -77,6 +77,42 @@
         this->registerVariables();
     }
 
+    BigExplosion::BigExplosion(Context* context, Vector3 initVelocity) : MobileEntity(context)
+    {
+        RegisterObject(BigExplosion);
+        this->setVelocity(initVelocity);
+
+        if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )
+            ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given.");
+
+        this->bStop_ = false;
+        this->LOD_ = LODParticle::Normal;
+
+        if ( GameMode::showsGraphics() )
+        {
+            try
+            {
+                this->init();
+            }
+            catch (const std::exception& ex)
+            {
+                orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl;
+                this->initZero();
+            }
+        }
+        else
+        {
+            this->initZero();
+        }
+
+        if (GameMode::isMaster())
+        {
+            this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this)));
+        }
+
+        this->registerVariables();
+    }
+
     void BigExplosion::init()
     {
         this->debrisEntity1_ = new MovableEntity(this->getContext());
@@ -151,8 +187,8 @@
         // TODO: particleSpawner is a static entity. It should probably be dynamic, for better explosions.
         //
         ParticleSpawner* effect = new ParticleSpawner(this->getContext());
-        // orxout() << "vel " << getVelocity() << endl;
-        // effect->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 200));
+        orxout() << "vel " << this->getVelocity() << endl;
+        // effect->setVelocity(this->getVelocity());
         effect->setDestroyAfterLife(true);
         effect->setSource("Orxonox/explosion2b");
         effect->setLifetime(4.0f);

Modified: code/branches/invaders/src/orxonox/worldentities/BigExplosion.h
===================================================================
--- code/branches/invaders/src/orxonox/worldentities/BigExplosion.h	2013-12-09 13:07:55 UTC (rev 9878)
+++ code/branches/invaders/src/orxonox/worldentities/BigExplosion.h	2013-12-09 13:08:26 UTC (rev 9879)
@@ -40,6 +40,7 @@
     {
         public:
             BigExplosion(Context* context);
+            BigExplosion(Context* context, Vector3 initVelocity);
             virtual ~BigExplosion();
 
             inline void setLOD(LODParticle::Value level)

Modified: code/branches/invaders/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/invaders/src/orxonox/worldentities/pawns/Pawn.cc	2013-12-09 13:07:55 UTC (rev 9878)
+++ code/branches/invaders/src/orxonox/worldentities/pawns/Pawn.cc	2013-12-09 13:08:26 UTC (rev 9879)
@@ -364,9 +364,10 @@
         this->bAlive_ = false;
         this->setDestroyWhenPlayerLeft(false);
 
-        BigExplosion* chunk = new BigExplosion(this->getContext());
+        orxout() << "big explosion: " << this->getVelocity() << endl;
+        BigExplosion* chunk = new BigExplosion(this->getContext(), this->getVelocity());
         chunk->setPosition(this->getPosition());
-        chunk->setVelocity(this->getVelocity());
+        // chunk->setVelocity(this->getVelocity());
 
     }
     void Pawn::deatheffect()
@@ -376,6 +377,7 @@
             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
             effect->setPosition(this->getPosition());
             effect->setOrientation(this->getOrientation());
+            effect->setVelocity(this->getVelocity());
             effect->setDestroyAfterLife(true);
             effect->setSource("Orxonox/explosion2b");
             effect->setLifetime(4.0f);
@@ -384,6 +386,7 @@
             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
             effect->setPosition(this->getPosition());
             effect->setOrientation(this->getOrientation());
+            effect->setVelocity(this->getVelocity());
             effect->setDestroyAfterLife(true);
             effect->setSource("Orxonox/smoke6");
             effect->setLifetime(4.0f);
@@ -392,6 +395,7 @@
             ParticleSpawner* effect = new ParticleSpawner(this->getContext());
             effect->setPosition(this->getPosition());
             effect->setOrientation(this->getOrientation());
+            effect->setVelocity(this->getVelocity());
             effect->setDestroyAfterLife(true);
             effect->setSource("Orxonox/sparks");
             effect->setLifetime(4.0f);




More information about the Orxonox-commit mailing list