[Orxonox-commit 5489] r10152 - in code/branches/surfaceraceHS14: data/levels data/levels/templates src/modules/dodgerace2
sriedel at orxonox.net
sriedel at orxonox.net
Wed Dec 3 17:18:25 CET 2014
Author: sriedel
Date: 2014-12-03 17:18:24 +0100 (Wed, 03 Dec 2014)
New Revision: 10152
Added:
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.cc
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.h
Modified:
code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw
code/branches/surfaceraceHS14/data/levels/templates/DodgeRacePattern.oxt
code/branches/surfaceraceHS14/src/modules/dodgerace2/CMakeLists.txt
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRacePrereqs.h
code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc
Log:
Almost there. Death doesnt work
Modified: code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw
===================================================================
--- code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw 2014-12-03 16:06:11 UTC (rev 10151)
+++ code/branches/surfaceraceHS14/data/levels/DodgeRace.oxw 2014-12-03 16:18:24 UTC (rev 10152)
@@ -25,7 +25,7 @@
<?lua include("includes/notifications.oxi") ?>
<Scene
- ambientlight = "2.0, 2.0, 2.0"
+ ambientlight = "1.0, 1.0, 1.0"
skybox = "Orxonox/skyBoxClouds"
negativeWorldRange = "-100000, -100000, -100000"
positiveWorldRange = " 100000, 100000, 100000"
@@ -45,32 +45,10 @@
<DodgeRaceCenterPoint name=invadercenter />
-
-
- <StaticEntity position="1500,40,50" direction="0,0,0" scale="1" collisionType=static mass=0 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="blackcube.mesh" scale3D="50,50,50" />
- </attached>
-
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="50,50,50" />
- </collisionShapes>
-
- </StaticEntity>
- <StaticEntity position="4500,50,-30" direction="0,0,0" scale="1" collisionType=static mass=1 friction=0.01 >
- <attached>
- <Model position="0,0,0" mesh="blackcube.mesh" scale3D="50,40,50" />
- </attached>
-
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="50,50,50" />
- </collisionShapes>
-
- </StaticEntity>
- <StaticEntity position="0,-10,0" direction="0,0,0" scale="1" collisionType=static mass=1 friction=0.01 >
+ <StaticEntity position="0,-50,0" direction="0,0,0" scale="1" collisionType=static mass=1 friction=0.01 >
<attached>
- <Model position="0,0,0" mesh="CubeGround.mesh" scale3D="100000,2,100000" />
+ <Model position="0,0,0" mesh="plane.mesh" scale3D="100000,0,100000" />
</attached>
<collisionShapes>
Modified: code/branches/surfaceraceHS14/data/levels/templates/DodgeRacePattern.oxt
===================================================================
--- code/branches/surfaceraceHS14/data/levels/templates/DodgeRacePattern.oxt 2014-12-03 16:06:11 UTC (rev 10151)
+++ code/branches/surfaceraceHS14/data/levels/templates/DodgeRacePattern.oxt 2014-12-03 16:18:24 UTC (rev 10152)
@@ -1,35 +1,61 @@
-<Template name=DodgeRaceCube02>
+<Template name=DodgeRaceCube01>
- <StaticEntity position="0,0,0" direction="0,0,0" scale="1" collisionType=static mass=1 friction=0.01 >
+ <DodgeRaceCube position="0,0,0" direction="0,0,0" scale="1" collisionType=dynamic mass=1 friction=0.01 >
<attached>
- <Model position="0,0,0" mesh="blackcube.mesh" scale3D="600,50,50" />
- <Model position="0,0,950" mesh="blackcube.mesh" scale3D="600,50,50" />
- <Model position="800,0,50" mesh="blackcube.mesh" scale3D="100,50,100" />
- <Model position="800,0,850" mesh="blackcube.mesh" scale3D="100,50,100" />
- <Model position="850,0,250" mesh="blackcube.mesh" scale3D="50,40,100" />
- <Model position="850,0,450" mesh="blackcube.mesh" scale3D="50,40,100" />
- <Model position="850,0,650" mesh="blackcube.mesh" scale3D="50,40,100" />
+ <Model position="700,0,50" mesh="CuboidBody.mesh" scale3D="300,50,50" />
+ <Model position="700,0,1150" mesh="CuboidBody.mesh" scale3D="300,50,50" />
+ <Model position="1200,0,200" mesh="CuboidBody.mesh" scale3D="100,50,100" />
+ <Model position="1200,0,1000" mesh="CuboidBody.mesh" scale3D="100,50,100" />
+ <Model position="1250,-10,430" mesh="CuboidBody.mesh" scale3D="50,40,30" />
+ <Model position="1250,-10,600" mesh="CuboidBody.mesh" scale3D="50,40,30" />
+ <Model position="1250,-10,770" mesh="CuboidBody.mesh" scale3D="50,40,30" />
+ <Model position="1650,0,350" mesh="CuboidBody.mesh" scale3D="50,50,150" />
+ <Model position="1650,0,850" mesh="CuboidBody.mesh" scale3D="50,50,150" />
+ <Model position="2100,0,150" mesh="CuboidBody.mesh" scale3D="100,50,150" />
+ <Model position="2100,0,1050" mesh="CuboidBody.mesh" scale3D="100,50,150" />
+ <Model position="2150,0,600" mesh="CuboidBody.mesh" scale3D="50,50,100" />
</attached>
<collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="1,1,1" />
+ <BoxCollisionShape position="700,0,50" halfExtents="300,50,50" />
+ <BoxCollisionShape position="700,0,1150" halfExtents="300,50,50" />
+ <BoxCollisionShape position="1200,0,200" halfExtents="100,50,100" />
+ <BoxCollisionShape position="1200,0,1000" halfExtents="100,50,100" />
+ <BoxCollisionShape position="1250,-10,430" halfExtents="50,40,30" />
+ <BoxCollisionShape position="1250,-10,600" halfExtents="50,40,30" />
+ <BoxCollisionShape position="1250,-10,770" halfExtents="50,40,30" />
+ <BoxCollisionShape position="1650,0,350" halfExtents="50,50,150" />
+ <BoxCollisionShape position="1650,0,850" halfExtents="50,50,150" />
+ <BoxCollisionShape position="2100,0,150" halfExtents="100,50,150" />
+ <BoxCollisionShape position="2100,0,1050" halfExtents="100,50,150" />
+ <BoxCollisionShape position="2150,0,600" halfExtents="50,50,100" />
</collisionShapes>
- </StaticEntity>
+ </DodgeRaceCube>
</Template>
-<Template name=DodgeRaceCube01>
+<Template name=DodgeRaceCube02>
- <StaticEntity position="0,0,0" direction="0,0,0" scale="1" collisionType=static mass=1 friction=0.01 >
+ <DodgeRaceCube position="0,0,0" direction="0,0,0" scale="1" collisionType=dynamic mass=1 friction=0.01 >
<attached>
- <Model position="0,0,0" mesh="blackcube.mesh" scale3D="50,50,100" />
- <Model position="50,0,150" mesh="blackcube.mesh" scale3D="50,50,50" />
- <Model position="40,0,-155" mesh="blackcube.mesh" scale3D="50,50,50" />
+ <Model position="450,0,300" mesh="CuboidBody.mesh" scale3D="50,50,300" />
+ <Model position="950,0,850" mesh="CuboidBody.mesh" scale3D="50,50,350" />
+ <Model position="1350,0,200" mesh="CuboidBody.mesh" scale3D="50,50,200" />
+ <Model position="1350,0,700" mesh="CuboidBody.mesh" scale3D="50,50,100" />
+ <Model position="1750,0,350" mesh="CuboidBody.mesh" scale3D="50,50,350" />
+ <Model position="2000,0,1000" mesh="CuboidBody.mesh" scale3D="100,50,100" />
+ <Model position="1650,0,1150" mesh="CuboidBody.mesh" scale3D="450,50,50" />
</attached>
<collisionShapes>
- <BoxCollisionShape position="0,1000,0" halfExtents="1,1,1" />
+ <BoxCollisionShape position="450,0,300" halfExtents="50,50,300" />
+ <BoxCollisionShape position="950,0,850" halfExtents="50,50,350" />
+ <BoxCollisionShape position="1350,0,200" halfExtents="50,50,200" />
+ <BoxCollisionShape position="1350,0,700" halfExtents="50,50,100" />
+ <BoxCollisionShape position="1750,0,350" halfExtents="50,50,350" />
+ <BoxCollisionShape position="2000,0,1000" halfExtents="100,50,100" />
+ <BoxCollisionShape position="1650,0,1150" halfExtents="450,50,50" />
</collisionShapes>
- </StaticEntity>
+ </DodgeRaceCube>
</Template>
\ No newline at end of file
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace2/CMakeLists.txt
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/CMakeLists.txt 2014-12-03 16:06:11 UTC (rev 10151)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/CMakeLists.txt 2014-12-03 16:18:24 UTC (rev 10152)
@@ -2,6 +2,7 @@
DodgeRace.cc
DodgeRaceCenterPoint.cc
DodgeRaceShip.cc
+DodgeRaceCube.cc
DodgeRaceHUDinfo.cc
)
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc 2014-12-03 16:06:11 UTC (rev 10151)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.cc 2014-12-03 16:18:24 UTC (rev 10152)
@@ -33,6 +33,7 @@
#include "DodgeRace.h"
#include "DodgeRaceShip.h" // Necessary for getPlayer function. Do NOT include this in Header!
+#include "DodgeRaceCube.h"
namespace orxonox
{
@@ -58,6 +59,7 @@
multiplier = 1;
b_combo = false;
counter = 0;
+ pattern = 1;
lastPosition = 0;
// spawn enemy every 3.5 seconds
//enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&DodgeRace::spawnEnemy, this)));
@@ -93,16 +95,42 @@
counter = counter + (currentPosition - lastPosition);
lastPosition = currentPosition;
- if(counter >= 5000)
+ for(int i=0; i< cubeList.size();i++)
{
+ if(cubeList.at(i)->getPosition().x < currentPosition-3000)
+ {
+ cubeList.at(i)->destroy();
+ cubeList.erase(cubeList.begin()+i);
+ }
+ }
+
+ if(counter >= 3000)
+ {
counter = 0;
- WeakPtr<StaticEntity> stentity = new StaticEntity(this->center_->getContext()); //this->center_->getContext()
- stentity->addTemplate("DodgeRaceCube01");
+ for(int i = 0; i<6; i++)
+ {
+ WeakPtr<DodgeRaceCube> cube = new DodgeRaceCube(this->center_->getContext());
+ cubeList.push_back(cube);
+ switch(pattern)
+ {
+ case 1: cube->addTemplate("DodgeRaceCube01");
+ break;
+ case 2: cube->addTemplate("DodgeRaceCube02");
+ break;
- stentity->setPosition(getPlayer()->getWorldPosition() + Vector3(5000, 0, 0));
- //stentity->setScale3D(50,50,50);
+ }
+
+ cube->setPosition(getPlayer()->getWorldPosition() + Vector3(5000, 0, -3600 + (i*1200)));
+ //stEntity->setScale3D(50,50,50);
+ }
+
+
+ pattern %= 2;
+ pattern ++;
+
}
+
}
SUPER(DodgeRace, tick, dt);
}
@@ -165,7 +193,15 @@
void DodgeRace::start()
{
+ orxout() << "start function called." << endl;
init();
+ for(int i=0; i< cubeList.size();i++)
+ {
+ cubeList.at(i)->destroy();
+ cubeList.erase(cubeList.begin()+i);
+
+ }
+ cubeList.clear();
// Set variable to temporarily force the player to spawn.
this->bForceSpawn_ = true;
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h 2014-12-03 16:06:11 UTC (rev 10151)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRace.h 2014-12-03 16:18:24 UTC (rev 10152)
@@ -50,6 +50,7 @@
#include "gamestates/GSLevel.h"
#include "chat/ChatManager.h"
+#include <vector>
// ! HACK
#include "infos/PlayerInfo.h"
@@ -95,12 +96,14 @@
int lives;
int multiplier;
int counter;
+ int pattern;
int currentPosition;
int lastPosition;
private:
WeakPtr<DodgeRaceShip> getPlayer();
WeakPtr<DodgeRaceShip> player;
+ std::vector<DodgeRaceCube*> cubeList;
void toggleShowLevel(){bShowLevel = !bShowLevel;}
void addPoints(int numPoints);
Added: code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.cc (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.cc 2014-12-03 16:18:24 UTC (rev 10152)
@@ -0,0 +1,46 @@
+/* ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Samuel Riedel
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DodgeRace.cc
+ @brief Implementation of the DodgeRace class.
+*/
+
+#include "DodgeRaceCube.h"
+#include "DodgeRace.h"
+
+namespace orxonox
+{
+ RegisterClass(DodgeRaceCube);
+
+ DodgeRaceCube::DodgeRaceCube(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(DodgeRaceCube);
+ }
+
+
+}
Added: code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.h (rev 0)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceCube.h 2014-12-03 16:18:24 UTC (rev 10152)
@@ -0,0 +1,54 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Samuel Riedel
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DodgeRace.h
+ @brief Gametype.
+ @ingroup DodgeRace
+*/
+
+#ifndef _DodgeRaceCube_H__
+#define _DodgeRaceCube_H__
+
+#include "dodgerace2/DodgeRacePrereqs.h"
+
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _DodgeRaceExport DodgeRaceCube : public MovableEntity
+ {
+ public:
+ DodgeRaceCube(Context* context);
+
+ private:
+ };
+}
+
+#endif /* _DodgeRaceCube_H__ */
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRacePrereqs.h
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRacePrereqs.h 2014-12-03 16:06:11 UTC (rev 10151)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRacePrereqs.h 2014-12-03 16:18:24 UTC (rev 10152)
@@ -70,6 +70,7 @@
class DodgeRace;
class DodgeRaceCenterPoint;
class DodgeRaceShip;
+ class DodgeRaceCube;
//class DodgeRaceEnemy;
//class DodgeRaceEnemyShooter;
//class DodgeRaceWeapon;
Modified: code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc
===================================================================
--- code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc 2014-12-03 16:06:11 UTC (rev 10151)
+++ code/branches/surfaceraceHS14/src/modules/dodgerace2/DodgeRaceShip.cc 2014-12-03 16:18:24 UTC (rev 10152)
@@ -74,12 +74,13 @@
{
velocity.y = 0;
// restart if game ended
+ /*
if (getGame())
if (getGame()->bEndGame)
{
getGame()->start();
return;
- }
+ }*/
}
/*
if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)
More information about the Orxonox-commit
mailing list