[Orxonox-commit 6777] r11405 - in code/branches/SuperOrxoBros_FS17: data/levels data/overlays src/modules/superorxobros
jkindle at orxonox.net
jkindle at orxonox.net
Thu Apr 27 15:08:17 CEST 2017
Author: jkindle
Date: 2017-04-27 15:08:16 +0200 (Thu, 27 Apr 2017)
New Revision: 11405
Added:
code/branches/SuperOrxoBros_FS17/data/overlays/SOBHUD.oxo
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.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/Orxo.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
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/SOBMushroom.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h
Log:
Added a HUD and type to QBlocks
Modified: code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw
===================================================================
--- code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw 2017-04-27 13:08:16 UTC (rev 11405)
@@ -10,8 +10,23 @@
include("jumpHUD.oxo")
include("stats.oxo")
include("templates/lodInformation.oxt")
+ include("overlays/SOBHUD.oxo")
?>
+
+ <Template name=mushroom defaults=0>
+ <SOBMushroom collisionType="dynamic" speed=30>
+ <attached>
+ <Model mesh="QCube.mesh" position="0,0,20" scale=10/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,20" halfExtents="5,5,5" /><!-- 1 -->
+ </collisionShapes>
+ </SOBMushroom>
+ </Template>
+
+
+
<Template name=sobfigurecameras defaults=0>
<SOBFigure>
<camerapositions>
@@ -117,15 +132,15 @@
-<!-- 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"> <!-- 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" type="Mushroom" position="120,0,20"> <!-- 1 -->
<attached>
- <Model mesh="QCube.mesh" position="120,0,20" scale=10/>
- <Model mesh="Cube1.1.mesh" position="120,0,30" scale=10 visible="false"/>
+ <Model mesh="QCube.mesh" scale=10/>
+ <Model mesh="Cube1.1.mesh" position="0,0,10" scale=10 visible="false"/>
</attached>
<collisionShapes>
- <BoxCollisionShape position="120,0,20" halfExtents="5,5,5" />
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
</collisionShapes>
</SOBQBlock>
@@ -142,7 +157,7 @@
</collisionShapes>
</SOBQBlock>
- <SOBMushroom collisionType="dynamic" speed=30>
+ <SOBMushroom collisionType="dynamic" speed=30>
<attached>
<Model mesh="QCube.mesh" position="0,0,20" scale=10/>
@@ -166,11 +181,11 @@
</collisionShapes>
</SOBQBlock>
-
- <SOBQBlock collisionType="static"><!-- ? Block -->
+
+ <SOBQBlock collisionType="static"><!-- ? Block -->
<attached>
<Model mesh="QCube.mesh" position="190,0,20" scale=10/> <!-- 6 -->
<Model mesh="Cube1.1.mesh" position="190,0,30" scale=10 visible="false"/>
@@ -255,7 +270,7 @@
-
+
<SOBQBlock collisionType="static"> <!-- 10er Block --> <!-- 2 -->
<attached>
<Model mesh="QCube.mesh" position="670,0,20" scale=10/>
@@ -355,8 +370,8 @@
<BoxCollisionShape position="645,0,60" halfExtents="15,5,5" /> <!-- 1 -->
<BoxCollisionShape position="720,0,20" halfExtents="5,5,5" /> <!-- 4 -->
-
+
<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 -->
Added: code/branches/SuperOrxoBros_FS17/data/overlays/SOBHUD.oxo
===================================================================
--- code/branches/SuperOrxoBros_FS17/data/overlays/SOBHUD.oxo (rev 0)
+++ code/branches/SuperOrxoBros_FS17/data/overlays/SOBHUD.oxo 2017-04-27 13:08:16 UTC (rev 11405)
@@ -0,0 +1,111 @@
+<Template name="spectatorhud">
+ <OverlayGroup name = "spectatorhud" scale = "1, 1">
+ </OverlayGroup>
+</Template>
+
+<Template name="SOBHUD">
+ <OverlayGroup name="SOBHUD" scale = "1, 1">
+
+ <OverlayText
+ position = "0.02, 0.02"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+ caption = "O R X O\n"
+ />
+ <SOBHUDInfo
+ position = "0.02, 0.06"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.045
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+ type = "Points"
+
+ />
+
+
+
+ <SOBHUDInfo
+ position = "0.22, 0.06"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.045
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "left"
+ type = "Coins"
+
+ />
+
+
+
+ <OverlayText
+ position = "0.75, 0.02"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "middle"
+ caption = "WORLD\n 1-1"
+ />
+
+
+
+
+
+
+ <OverlayText
+ position = "0.98, 0.02"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "right"
+ caption = "TIME\n"
+ />
+ <SOBHUDInfo
+ position = "0.98, 0.06"
+ pickpoint = "0.0, 0.0"
+ font = "ShareTechMono"
+ textsize = 0.04
+ colour = "1.0, 1.0, 1.0, 1.0"
+ align = "right"
+ type = "Time"
+
+ />
+
+
+
+
+
+
+ </OverlayGroup>
+</Template>
+
+
+<Template name="spaceshiphud">
+ <OverlayGroup name = "spaceshiphud" scale = "1, 1">
+ <HUDHealthBar
+ name = "HealthBar1"
+ background = "Orxonox/HealthBarBackground"
+ size = "0.35, 0.0875"
+ position = "0.0 , 0.9 "
+ pickpoint = "0, 1"
+ bartexture = "healthbar_bar.png"
+ textfont = "VeraMono"
+ textusebarcolour = true
+ textscale = 0.4
+ textoffset = "0.325, -0.825"
+ textpickpoint = "0, 0"
+ textalign = "right"
+ correctaspect = true
+ iconmaterial = "Orxonox/BarIconHealth"
+ >
+ <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+ <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+ <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+ </HUDHealthBar>
+ </OverlayGroup>
+</Template>
\ No newline at end of file
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt 2017-04-27 13:08:16 UTC (rev 11405)
@@ -6,6 +6,7 @@
SOBItem.cc
SOBQBlock.cc
SOBMushroom.cc
+ SOBHUDInfo.cc
)
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/Orxo.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/Orxo.h 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/Orxo.h 2017-04-27 13:08:16 UTC (rev 11405)
@@ -43,42 +43,48 @@
{
class Orxo : public SpaceShip
{
- public:
- Orxo(Context* context);
+ public:
+ Orxo(Context* context);
- virtual void tick(float dt) override;
+ virtual void tick(float dt) override;
// overwrite for 2d movement
- virtual void moveFrontBack(const Vector2& value) override;
- virtual void moveRightLeft(const Vector2& value) override;
+ virtual void moveFrontBack(const Vector2& value) override;
+ virtual void moveRightLeft(const Vector2& value) override;
// Starts or stops fireing
- virtual void boost(bool bBoost) override;
+ virtual void boost(bool bBoost) override;
//no rotation!
- virtual void rotateYaw(const Vector2& value) override{};
- virtual void rotatePitch(const Vector2& value) override{};
+ virtual void rotateYaw(const Vector2& value) override{};
+ virtual void rotatePitch(const Vector2& value) override{};
//return to main menu if game has ended.
- virtual void rotateRoll(const Vector2& value) override;
+ virtual void rotateRoll(const Vector2& value) override;
- virtual void updateLevel();
+ virtual void updateLevel();
- virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+ virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
- protected:
- virtual void death() override;
- private:
+
+
+
+
+
+
+ protected:
+ virtual void death() override;
+ private:
//SOB* getGame();
//WeakPtr<SOB> game;
- Camera* camera;
- float speed, damping, posforeward;
- float lastTimeFront, lastTimeLeft, lastTime;
- struct Velocity
- {
- float x;
- float y;
- } velocity, desiredVelocity;
+ Camera* camera;
+ float speed, damping, posforeward;
+ float lastTimeFront, lastTimeLeft, lastTime;
+ struct Velocity
+ {
+ float x;
+ float y;
+ } velocity, desiredVelocity;
// WeakPtr<InvaderEnemy> lastEnemy;
//WeakPtr<Projectile> lastShot;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc 2017-04-27 13:08:16 UTC (rev 11405)
@@ -63,7 +63,10 @@
this->center_ = nullptr;
figure_ = nullptr;
- setHUDTemplate("JumpHUD");
+ setHUDTemplate("SOBHUD");
+ coins_=0;
+ points_=0;
+ timeLeft_=400.0;
}
@@ -104,7 +107,7 @@
}
// Call start for the parent class.
- Deathmatch::start();
+ Gametype::start();
if (figure_ != nullptr)
{
@@ -151,6 +154,8 @@
if (this->figure_ != nullptr && figure_->dead_)
orxout() << "DEED" << endl;
+
+ timeLeft_-=dt*2.5;
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h 2017-04-27 13:08:16 UTC (rev 11405)
@@ -45,34 +45,60 @@
namespace orxonox
{
-
+
class _SOBExport SOB : public Deathmatch
{
- public:
+ public:
SOB(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~SOB(); //!< Destructor. Cleans up, if initialized.
virtual void tick(float dt) override;
-
+
void setCenterpoint(SOBCenterpoint* center)
- { this->center_ = center; }
- virtual void start() override;
+ { this->center_ = center; }
+ virtual void start() override;
virtual void end() override;
virtual void spawnPlayer(PlayerInfo* player) override;
- PlayerInfo* getPlayer() const;
+ PlayerInfo* getPlayer() const;
-
-
+ int getPoints() {
+ return points_;
+ }
+ int getCoins() {
+ return coins_;
+ }
+ void addCoin() {
+ ++coins_;
+ points_+=200;
+ }
+ void addMushroom() {
+ points_+=1000;
+ }
+ int getTimeLeft() {
+ return timeLeft_;
+ }
+
+
+ virtual void playerEntered(PlayerInfo* player) override
+ {
+ Gametype::playerEntered(player);
+ }
+
+
+ WeakPtr<SOBCenterpoint> center_;
+
protected:
-
+
void cleanup(); //!< Cleans up the Gametype
- WeakPtr<SOBCenterpoint> center_;
WeakPtr<SOBFigure> figure_;
WeakPtr<Camera> camera;
-
-
- };
-}
+ int points_;
+ int coins_;
+ float timeLeft_;
+
+ };
+ }
+
#endif /* _Pong_H__ */
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc 2017-04-27 13:08:16 UTC (rev 11405)
@@ -40,6 +40,7 @@
#include "graphics/ParticleSpawner.h"
#include "SOBMushroom.h"
+#include "SOB.h"
namespace orxonox
{
@@ -65,8 +66,10 @@
pitch_ = 0.0;
dead_ = false;
+ gotPowerUp_ = false;
+
setAngularFactor(0.0);
- this->enableCollisionCallback();
+ this->enableCollisionCallback();
}
@@ -75,12 +78,17 @@
isColliding_ = true;
SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject);
- if (mush != nullptr) {
- orxout() << "YEPPIE" << endl;
- //DESTROY THE OTHER OBJECT otherObject.destroyLater();
+ // ADD ANOTHER OBJECT FOR BAD GUMBAS AND REMOVE POWERUP OR KILL PLAYER ON COLLISION WITHOUT Z-ACCELERATION
+ if (mush != nullptr && !(mush->hasCollided_)) {
+ otherObject->destroyLater();
+ gotPowerUp_ = true;
+ SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+ SOBGame->addMushroom();
+ mush->hasCollided_ = true;
+
}
-return true;
+ return true;
}
@@ -100,58 +108,58 @@
if (particlespawner_ == NULL) {
for (WorldEntity* object : this->getAttachedObjects())
{
- if (object->isA(Class(ParticleSpawner)))
- particlespawner_ = object;
-
- }
-
+ if (object->isA(Class(ParticleSpawner)))
+ particlespawner_ = object;
+
}
-
+ }
- if (firePressed_ == false) {
- gravityAcceleration_ = 350.0;
- }
- if (hasLocalController())
- {
- Vector3 velocity = getVelocity();
- Vector3 position = getPosition();
+ if (firePressed_ == false) {
+ gravityAcceleration_ = 350.0;
+ }
- if (position.z < -100)
- dead_ = true;
+ if (hasLocalController())
+ {
+ Vector3 velocity = getVelocity();
+ Vector3 position = getPosition();
- if (dead_) {
- velocity.x = 0;
- velocity.z = 0;
- setVelocity(velocity);
- return;
- }
+ if (position.z < -100)
+ dead_ = true;
- int maxvelocity_x = 100;
- int speedAddedPerTick = 5;
- int camMaxOffset = 25;
+ if (dead_) {
+ velocity.x = 0;
+ velocity.z = 0;
+ setVelocity(velocity);
+ return;
+ }
- timeSinceLastFire_ += dt;
- lastSpeed_z = velocity.z;
+ int maxvelocity_x = 100;
+ int speedAddedPerTick = 5;
+ int camMaxOffset = 25;
+ timeSinceLastFire_ += dt;
+ lastSpeed_z = velocity.z;
+
+
//Handle the rocket fire from the jetpack
- if (velocity.z > 40)
- particlespawner_->setVisible(true);
- else
- particlespawner_->setVisible(false);
+ if (velocity.z > 40)
+ particlespawner_->setVisible(true);
+ else
+ particlespawner_->setVisible(false);
//If player hits space and does not move in z-dir
- if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
- gravityAcceleration_ = 100.0;
+ if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
+ gravityAcceleration_ = 100.0;
velocity.z = 110; //150
}
@@ -162,7 +170,7 @@
float rot = getOrientation().getRoll().valueDegrees();
if (moveRightPressed_) {
if (rot < 0.0)
- setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
+ setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
if (std::abs(velocity.x) < maxvelocity_x) {
velocity.x += speedAddedPerTick;
@@ -177,7 +185,7 @@
}
} else if (moveLeftPressed_) {
if (rot >= 0.0)
- setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
+ setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
if (std::abs(velocity.x) < maxvelocity_x) {
velocity.x -= speedAddedPerTick;
@@ -199,7 +207,7 @@
campos.x = position.x - camMaxOffset;
cam->setPosition(campos);
}
- if (campos.x - camMaxOffset > position.x) {
+ if (campos.x - camMaxOffset > position.x) {
campos.x = position.x + camMaxOffset;
cam->setPosition(campos);
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h 2017-04-27 13:08:16 UTC (rev 11405)
@@ -60,6 +60,7 @@
private:
+ bool gotPowerUp_;
bool moveUpPressed_;
bool moveDownPressed_;
bool moveLeftPressed_;
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc 2017-04-27 13:08:16 UTC (rev 11405)
@@ -0,0 +1,154 @@
+/*
+ * 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:
+ * Florian Zinggeler
+ *
+ */
+
+#include "SOBHUDInfo.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+#include "SOB.h"
+#include <sstream>
+#include <iomanip>
+
+
+
+namespace orxonox
+{
+ RegisterClass(SOBHUDInfo);
+
+ SOBHUDInfo::SOBHUDInfo(Context* context) : OverlayText(context)
+ {
+ RegisterObject(SOBHUDInfo);
+
+ this->SOBGame = nullptr;
+
+ }
+
+ void SOBHUDInfo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(SOBHUDInfo, XMLPort, xmlelement, mode);
+ XMLPortParam(SOBHUDInfo, "type", setType, getType, xmlelement, mode).defaultValues(false);
+
+
+ }
+
+ void SOBHUDInfo::tick(float dt)
+ {
+ SUPER(SOBHUDInfo, tick, dt);
+
+ if (this->SOBGame)
+ {
+
+ // setPosition(Vector2(0.1, 0.65));
+ if (this->type_ == "Coins") {
+ // this->setCaption("Game ends in 30 seconds.\nPress (e)xit / (q)uit to go to the main menu.\nTo restart fly out of the screen!");
+
+
+ std::stringstream ss;
+ ss << "cc x " << std::setw(2) << std::setfill('0') << SOBGame->getCoins();
+ std::string s = ss.str();
+
+ this->setCaption(s);
+
+ }
+ if (this->type_ == "Points") {
+ std::stringstream ss;
+ ss << std::setw(6) << std::setfill('0') << SOBGame->getPoints();
+ std::string s = ss.str();
+ this->setCaption(s);
+ }
+ if (this->type_ == "Time") {
+ std::stringstream ss;
+ ss << SOBGame->getTimeLeft();
+ std::string s = ss.str();
+ this->setCaption(s);
+ }
+
+
+
+ // const std::string& Level = multi_cast<std::string>(this->SOBGame->getLevel());
+ // if (this->SOBGame->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 fly out of the screen!");
+ // setTextSize(0.05);
+ // this->SOBGame->bEndGame = true;
+ // }
+ // else if (this->SOBGame->bShowLevel)
+ // {
+ // setTextSize(0.1);
+ // setPosition(Vector2(0.3, 0.55));
+ // std::stringstream sstm;
+ // sstm << "Level " << Level;
+ // this->setCaption(sstm.str()); // + level
+ // }
+ // else
+ // {
+ // setTextSize(0.04);
+ // setPosition(Vector2(0.14, 0.055));
+ // this->setCaption(Level);
+ // }
+ // ////////////
+ // const std::string& points = multi_cast<std::string>(this->SOBGame->getPoints());
+ // if (this->SOBGame->lives <= 0)
+ // {
+ // setTextSize(0.2);
+ // setPosition(Vector2(0.1, 0.25));
+ // this->setCaption("Final score:\n" + points);
+ // this->setColour(ColourValue(1, 0, 0, 1));
+ // }
+ // else
+ // {
+ // setTextSize(0.04);
+ // setPosition(Vector2(0.14, 0.1));
+ // this->setColour(ColourValue(1, 1, 1, 1));
+ // this->setCaption(points);
+ // }
+
+ // /////////////
+ // int mult = this->SOBGame->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.01f + 0.04f);
+
+ }
+ }
+
+ void SOBHUDInfo::changedOwner()
+ {
+ SUPER(SOBHUDInfo, changedOwner);
+
+ if (this->getOwner() && this->getOwner()->getGametype())
+ {
+ this->SOBGame = orxonox_cast<SOB*>(this->getOwner()->getGametype());
+ }
+ else
+ {
+ this->SOBGame = nullptr;
+ }
+ }
+}
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h 2017-04-27 13:08:16 UTC (rev 11405)
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ * Florian Zinggeler
+ *
+ */
+
+#ifndef _SOBHUDInfo_H__
+#define _SOBHUDInfo_H__
+
+#include "superorxobros/SOBPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "overlays/OverlayText.h"
+
+namespace orxonox
+{
+ class _SOBExport SOBHUDInfo : public OverlayText, public Tickable
+ {
+ public:
+ SOBHUDInfo(Context* context);
+
+ virtual void tick(float dt) override;
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ virtual void changedOwner() override;
+
+ inline void setType(std::string type)
+ { this->type_ = type; }
+ inline std::string getType() const
+ { return this->type_; }
+
+
+ private:
+ SOB* SOBGame;
+ std::string type_;
+
+ };
+}
+#endif /* _SOBHUDInfo_H__ */
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc 2017-04-27 13:08:16 UTC (rev 11405)
@@ -53,6 +53,7 @@
this->enableCollisionCallback();
gravityAcceleration_ = 350.0;
speed_ = 0.0;
+ hasCollided_=false;
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h 2017-04-27 13:08:16 UTC (rev 11405)
@@ -59,7 +59,7 @@
float getSpeed() const
{ return speed_; }
-
+ bool hasCollided_;
protected:
float gravityAcceleration_;
float speed_;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h 2017-04-27 13:08:16 UTC (rev 11405)
@@ -79,6 +79,7 @@
class SOBItem;
class SOBQBlock;
class SOBMushroom;
+ class SOBHUDInfo;
/*
class PongScore;*/
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc 2017-04-27 13:08:16 UTC (rev 11405)
@@ -34,6 +34,9 @@
#include "SOBQBlock.h"
#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SOB.h"
+#include "SOBMushroom.h"
namespace orxonox
{
@@ -61,20 +64,52 @@
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());
+ for (WorldEntity* object : this->getAttachedObjects())
+ object->setVisible(!object->isVisible());
+
+ SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+ if (type_ == "Coin") {
+ SOBGame->addCoin();
}
+ if (type_ == "Mushroom") {
+ spawnMushroom();
+ }
-
-
}
return true;
}
+ void SOBQBlock::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(SOBQBlock, XMLPort, xmlelement, mode);
+ XMLPortParam(SOBQBlock, "type", setType, getType, xmlelement, mode).defaultValues(false);
+
+
+ }
+
+
+ void SOBQBlock::spawnMushroom() {
+ SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
+
+ SOBMushroom* mush = new SOBMushroom(center_->getContext());
+ Vector3 spawnpos = this->getWorldPosition();
+ spawnpos.z += 0;
+
+ if (mush != nullptr && center_ != nullptr)
+ {
+ mush->addTemplate("mushroom");
+
+
+
+ //newBoots->addTemplate(center_->getBootsTemplate());
+ mush->setPosition(spawnpos);
+ //newBoots->setProperties(leftBoundary, rightBoundary, lowerBoundary, upperBoundary, xVelocity, zVelocity);
+ //newBoots->setFigure(figure_);
+ //center_->attach(newBoots);
+ }
+ }
+
+
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h 2017-04-27 10:32:58 UTC (rev 11404)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h 2017-04-27 13:08:16 UTC (rev 11405)
@@ -40,9 +40,18 @@
SOBQBlock(Context* context);
virtual ~SOBQBlock();
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ void setType(std::string type) {
+ this->type_=type;
+ }
+ std::string getType() {
+ return this->type_;
+ }
protected:
bool used_;
+ std::string type_;
+ void spawnMushroom();
};
}
More information about the Orxonox-commit
mailing list