[Orxonox-commit 6772] r11400 - in code/branches/SuperOrxoBros_FS17: data/levels src/modules/superorxobros
jkindle at orxonox.net
jkindle at orxonox.net
Thu Apr 13 15:30:24 CEST 2017
Author: jkindle
Date: 2017-04-13 15:30:24 +0200 (Thu, 13 Apr 2017)
New Revision: 11400
Added:
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h
Modified:
code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
Log:
Added jetpack, rotation of player, Questionmark-blocks and Hitlistener for the QBlocks. Made description for David in XML file for usage of hittable blocks
Modified: code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw
===================================================================
--- code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw 2017-04-13 09:33:22 UTC (rev 11399)
+++ code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw 2017-04-13 13:30:24 UTC (rev 11400)
@@ -28,6 +28,7 @@
<SOBFigure camerapositiontemplate=sobfigurecameras collisionType="dynamic" position="0,0,30">
<attached>
<Model mesh="Orxo.mesh" scale=2.5 pitch=0 roll=90 yaw=90/>
+ <ParticleSpawner source="Orxonox/fire4" startdelay=0 position="-4,0,0" visible="false"/>
</attached>
<collisionShapes>
@@ -109,7 +110,29 @@
</StaticEntity>
//Luft1
- <Model mesh="Cube1.1.mesh" position="120,0,20" scale=10/><!-- ? Block --> <!-- 1 -->
+
+
+
+<!-- BLOCK 1 in der LUFT - alle analog wie diesen :) -->
+<!-- Sobald ein QBlock von unten gehittet wird, wechselt die Visibility von allen attached Models. Hier wuerde also Cube1.1 invisible und Cube2.12 visible. Die Collisionshape wird ja sowieso beibehalten. -->
+ <SOBQBlock collisionType="static">
+ <attached>
+ <Model mesh="Cube1.1.mesh" position="120,0,20" scale=10/>
+ <Model mesh="Cube2.12.mesh" position="120,0,20" scale=10 visible="false"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="120,0,20" halfExtents="5,5,5" /><!-- 1 -->
+ </collisionShapes>
+ </SOBQBlock>
+
+
+
+
+
+
+
+
+<!-- <Model mesh="Cube1.1.mesh" position="120,0,20" scale=10/><!-- ? Block --> <!-- 1 -->
<Model mesh="Cube1.1.mesh" position="160,0,20" scale=10 /> <!-- 2 -->
<Model mesh="Cube1.1.mesh" position="170,0,20" scale=10 /><!-- Item Block --> <!-- 3 -->
<Model mesh="Cube1.1.mesh" position="180,0,20" scale=10/> <!-- 4 -->
@@ -117,19 +140,19 @@
<Model mesh="Cube1.1.mesh" position="190,0,20" scale=10/><!-- ? Block --> <!-- 6 -->
<Model mesh="Cube1.1.mesh" position="200,0,20" scale=10/> <!-- 7 -->
- <StaticEntity collisionType="static">
- <collisionShapes>
- <BoxCollisionShape position="120,0,20" halfExtents="5,5,5" /><!-- 1 -->
- <BoxCollisionShape position="160,0,20" halfExtents="5,5,5" /><!-- 2 -->
- <BoxCollisionShape position="170,0,20" halfExtents="5,5,5" /><!-- 3 -->
- <BoxCollisionShape position="180,0,20" halfExtents="5,5,5" /><!-- 4 -->
- <BoxCollisionShape position="180,0,60" halfExtents="5,5,5" /><!-- 5 -->
- <BoxCollisionShape position="190,0,20" halfExtents="5,5,5" /><!-- 6 -->
- <BoxCollisionShape position="200,0,20" halfExtents="5,5,5" /><!-- 7 -->
+ <StaticEntity collisionType="static">
+ <collisionShapes>
+ <!--<BoxCollisionShape position="120,0,20" halfExtents="5,5,5" /><!-- 1 -->
+ <BoxCollisionShape position="160,0,20" halfExtents="5,5,5" /><!-- 2 -->
+ <BoxCollisionShape position="170,0,20" halfExtents="5,5,5" /><!-- 3 -->
+ <BoxCollisionShape position="180,0,20" halfExtents="5,5,5" /><!-- 4 -->
+ <BoxCollisionShape position="180,0,60" halfExtents="5,5,5" /><!-- 5 -->
+ <BoxCollisionShape position="190,0,20" halfExtents="5,5,5" /><!-- 6 -->
+ <BoxCollisionShape position="200,0,20" halfExtents="5,5,5" /><!-- 7 -->
- </collisionShapes>
- </StaticEntity>
+ </collisionShapes>
+ </StaticEntity>
@@ -156,18 +179,18 @@
<Model mesh="Cube1.1.mesh" position="590,0,60" scale=10/>
<Model mesh="Cube1.1.mesh" position="600,0,60" scale=10/>
- <StaticEntity collisionType="static">
- <collisionShapes>
- <BoxCollisionShape position="500,0,20" halfExtents="5,5,5" />
- <BoxCollisionShape position="510,0,20" halfExtents="5,5,5" />
- <BoxCollisionShape position="520,0,20" halfExtents="5,5,5" />
- <BoxCollisionShape position="570,0,60" halfExtents="40,5,5" />
+ <StaticEntity collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="500,0,20" halfExtents="5,5,5" />
+ <BoxCollisionShape position="510,0,20" halfExtents="5,5,5" />
+ <BoxCollisionShape position="520,0,20" halfExtents="5,5,5" />
+ <BoxCollisionShape position="570,0,60" halfExtents="40,5,5" />
- </collisionShapes>
- </StaticEntity>
+ </collisionShapes>
+ </StaticEntity>
//Luft3
@@ -199,32 +222,32 @@
//Dreickklein+1 1190
- <StaticEntity collisionType="static">
- <collisionShapes>
- <BoxCollisionShape position="645,0,60" halfExtents="15,5,5" /> <!-- 1 -->
- <BoxCollisionShape position="670,0,20" halfExtents="5,5,5" /> <!-- 2 -->
- <BoxCollisionShape position="670,0,60" halfExtents="5,5,5" /> <!-- 3 -->
+ <StaticEntity collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="645,0,60" halfExtents="15,5,5" /> <!-- 1 -->
+ <BoxCollisionShape position="670,0,20" halfExtents="5,5,5" /> <!-- 2 -->
+ <BoxCollisionShape position="670,0,60" halfExtents="5,5,5" /> <!-- 3 -->
- <BoxCollisionShape position="720,0,20" halfExtents="5,5,5" /> <!-- 4 -->
- <BoxCollisionShape position="730,0,20" halfExtents="5,5,5" /> <!-- 5 -->
- <BoxCollisionShape position="780,0,20" halfExtents="5,5,5" /> <!-- 6 -->
- <BoxCollisionShape position="800,0,20" halfExtents="5,5,5" /> <!-- 7 -->
- <BoxCollisionShape position="800,0,60" halfExtents="5,5,5" /> <!-- 8 -->
- <BoxCollisionShape position="820,0,20" halfExtents="5,5,5" /> <!-- 9 -->
+ <BoxCollisionShape position="720,0,20" halfExtents="5,5,5" /> <!-- 4 -->
+ <BoxCollisionShape position="730,0,20" halfExtents="5,5,5" /> <!-- 5 -->
+ <BoxCollisionShape position="780,0,20" halfExtents="5,5,5" /> <!-- 6 -->
+ <BoxCollisionShape position="800,0,20" halfExtents="5,5,5" /> <!-- 7 -->
+ <BoxCollisionShape position="800,0,60" halfExtents="5,5,5" /> <!-- 8 -->
+ <BoxCollisionShape position="820,0,20" halfExtents="5,5,5" /> <!-- 9 -->
- <BoxCollisionShape position="890,0,20" halfExtents="5,5,5" /> <!-- 10 -->
- <BoxCollisionShape position="930,0,60" halfExtents="15,5,5" /> <!-- 11 -->
- <BoxCollisionShape position="990,0,60" halfExtents="5,5,5" /> <!-- 12 -->
- <BoxCollisionShape position="1020,0,60" halfExtents="5,5,5" /> <!-- 13 -->
- <BoxCollisionShape position="1005,0,20" halfExtents="10,5,5" /> <!-- 14 -->
- <BoxCollisionShape position="1000,0,60" halfExtents="5,5,5" /> <!-- 15 -->
- <BoxCollisionShape position="1010,0,60" halfExtents="5,5,5" /> <!-- 16 -->
+ <BoxCollisionShape position="890,0,20" halfExtents="5,5,5" /> <!-- 10 -->
+ <BoxCollisionShape position="930,0,60" halfExtents="15,5,5" /> <!-- 11 -->
+ <BoxCollisionShape position="990,0,60" halfExtents="5,5,5" /> <!-- 12 -->
+ <BoxCollisionShape position="1020,0,60" halfExtents="5,5,5" /> <!-- 13 -->
+ <BoxCollisionShape position="1005,0,20" halfExtents="10,5,5" /> <!-- 14 -->
+ <BoxCollisionShape position="1000,0,60" halfExtents="5,5,5" /> <!-- 15 -->
+ <BoxCollisionShape position="1010,0,60" halfExtents="5,5,5" /> <!-- 16 -->
- </collisionShapes>
- </StaticEntity>
+ </collisionShapes>
+ </StaticEntity>
@@ -253,18 +276,18 @@
<Model mesh="Dreieck.mesh" position="1270,0,-10" scale=10 Roll=90 Pitch=-90 yaw=90/>
- <StaticEntity collisionType="static">
- <collisionShapes>
- <BoxCollisionShape position="1400,0,20" halfExtents="5,5,5" />
- <BoxCollisionShape position="1410,0,20" halfExtents="5,5,5" />
- <BoxCollisionShape position="1420,0,20" halfExtents="5,5,5" />
- <BoxCollisionShape position="1430,0,20" halfExtents="5,5,5" />
+ <StaticEntity collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="1400,0,20" halfExtents="5,5,5" />
+ <BoxCollisionShape position="1410,0,20" halfExtents="5,5,5" />
+ <BoxCollisionShape position="1420,0,20" halfExtents="5,5,5" />
+ <BoxCollisionShape position="1430,0,20" halfExtents="5,5,5" />
- </collisionShapes>
- </StaticEntity>
+ </collisionShapes>
+ </StaticEntity>
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt 2017-04-13 09:33:22 UTC (rev 11399)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt 2017-04-13 13:30:24 UTC (rev 11400)
@@ -4,7 +4,7 @@
SOB.cc
SOBFigure.cc
SOBItem.cc
-
+ SOBQBlock.cc
)
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc 2017-04-13 09:33:22 UTC (rev 11399)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc 2017-04-13 13:30:24 UTC (rev 11400)
@@ -37,7 +37,9 @@
#include "core/XMLPort.h"
#include "graphics/Model.h"
#include "graphics/Camera.h"
+#include "graphics/ParticleSpawner.h"
+
namespace orxonox
{
RegisterClass(SOBFigure);
@@ -55,14 +57,29 @@
firePressed_ = false;
timeSinceLastFire_ = 0.0;
lastSpeed_z = 0.0;
+ isColliding_ = true;
+ particlespawner_ = NULL;
- gravityAcceleration_ = 250.0;
+ gravityAcceleration_ = 350.0;
pitch_ = 0.0;
dead_ = false;
setAngularFactor(0.0);
+ this->enableCollisionCallback();
}
+
+
+ bool SOBFigure::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
+
+ isColliding_ = true;
+
+
+return true;
+ }
+
+
+
void SOBFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(SOBFigure, XMLPort, xmlelement, mode);
@@ -69,10 +86,31 @@
}
+
+
void SOBFigure::tick(float dt)
{
SUPER(SOBFigure, tick, dt);
+ if (particlespawner_ == NULL) {
+ for (WorldEntity* object : this->getAttachedObjects())
+ {
+ if (object->isA(Class(ParticleSpawner)))
+ particlespawner_ = object;
+
+ }
+
+ }
+
+
+
+
+
+ if (firePressed_ == false) {
+ gravityAcceleration_ = 350.0;
+
+ }
+
if (hasLocalController())
{
Vector3 velocity = getVelocity();
@@ -95,22 +133,42 @@
+ //Handle the rocket fire from the jetpack
+ if (velocity.z > 40)
+ particlespawner_->setVisible(true);
+ else
+ particlespawner_->setVisible(false);
+
//If player hits space and does not move in z-dir
- if (firePressed_ && std::abs(velocity.z) < 0.07 && std::abs(lastSpeed_z) < 0.07) {
- velocity.z = 150;
+ if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
+ gravityAcceleration_ = 100.0;
+ velocity.z = 110; //150
}
// rotate(1,getOrientation()* WorldEntity::FRONT)
+
//Left-right movement with acceleration
+ float rot = getOrientation().getRoll().valueDegrees();
if (moveRightPressed_) {
+ if (rot < 0.0)
+ setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
+
if (std::abs(velocity.x) < maxvelocity_x) {
velocity.x += speedAddedPerTick;
+
+
+
+
+
// if (pitch_ > 0.0) {
// pitch -= turn_fac*dt);
// }
}
} else if (moveLeftPressed_) {
+ if (rot >= 0.0)
+ setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
+
if (std::abs(velocity.x) < maxvelocity_x) {
velocity.x -= speedAddedPerTick;
}
@@ -151,7 +209,7 @@
moveLeftPressed_ = false;
moveRightPressed_ = false;
moveDownPressed_ = false;
- firePressed_ = false;
+ isColliding_ = false;
}
@@ -194,6 +252,6 @@
void SOBFigure::boost(bool boost)
{
- firePressed_ = true;
+ firePressed_ = boost;
}
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h 2017-04-13 09:33:22 UTC (rev 11399)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h 2017-04-13 13:30:24 UTC (rev 11400)
@@ -32,6 +32,7 @@
#include "superorxobros/SOBPrereqs.h"
#include "worldentities/ControllableEntity.h"
+
namespace orxonox
{
class _SOBExport SOBFigure : public ControllableEntity
@@ -46,7 +47,8 @@
virtual void boost(bool boost) override;
-
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+
//virtual void CollisionWithEnemy(SOBEnemy* enemy);
@@ -68,6 +70,8 @@
float lastSpeed_z;
SOBCenterpoint* sobcenterpoint;
float pitch_;
+ bool isColliding_;
+ WorldEntity* particlespawner_;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc 2017-04-13 09:33:22 UTC (rev 11399)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc 2017-04-13 13:30:24 UTC (rev 11400)
@@ -66,7 +66,7 @@
bool SOBItem::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
-orxout() << "Watshc bum baem" << endl;
+//orxout() << "Watshc bum baem" << endl;
return true;
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h 2017-04-13 09:33:22 UTC (rev 11399)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h 2017-04-13 13:30:24 UTC (rev 11400)
@@ -49,7 +49,7 @@
virtual void setFigure(SOBFigure* newFigure);
virtual void touchFigure();
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
-
+
bool attachedToFigure_;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h 2017-04-13 09:33:22 UTC (rev 11399)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h 2017-04-13 13:30:24 UTC (rev 11400)
@@ -77,6 +77,7 @@
class SOB;
class SOBFigure;
class SOBItem;
+ class SOBQBlock;
/*
class PongScore;*/
}
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc 2017-04-13 13:30:24 UTC (rev 11400)
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file SOBQBlock.cc
+ @brief If this QBlock is created, attachedToFigure_ is set to false. When the figure picks it up, the variable is set to true and the figure starts flying fast until the fuel is reduced to zero.
+*/
+
+#include "SOBQBlock.h"
+
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterClass(SOBQBlock);
+
+ SOBQBlock::SOBQBlock(Context* context) : SOBItem(context)
+ {
+ RegisterObject(SOBQBlock);
+ used_ = false;
+
+ // setPosition(Vector3(0,0,0));
+ // setVelocity(Vector3(0,0,0));
+ // setAcceleration(Vector3(0,0,0));
+ // setProperties(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
+ }
+
+ SOBQBlock::~SOBQBlock()
+ {
+
+ }
+
+
+ bool SOBQBlock::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
+
+ float v_z = otherObject->getVelocity().z;
+ if (!used_ && v_z > 50.0) {
+ used_ = true;
+ orxout() << "WDestrozed the block" << v_z << endl;
+
+ for (WorldEntity* object : this->getAttachedObjects())
+ {
+
+
+ object->setVisible(!object->isVisible());
+ }
+
+
+
+ }
+ return true;
+ }
+
+
+}
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h 2017-04-13 13:30:24 UTC (rev 11400)
@@ -0,0 +1,50 @@
+/*
+ * 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:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _SOBQBlock_H__
+#define _SOBQBlock_H__
+
+#include "SOBPrereqs.h"
+#include "SOBItem.h"
+
+namespace orxonox
+{
+ class _SOBExport SOBQBlock : public SOBItem
+ {
+ public:
+ SOBQBlock(Context* context);
+ virtual ~SOBQBlock();
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+
+ protected:
+ bool used_;
+ };
+
+}
+
+#endif /* _SOBQBlock_H__ */
More information about the Orxonox-commit
mailing list