[Orxonox-commit 6788] r11416 - in code/branches/SuperOrxoBros_FS17: data/levels src/modules/superorxobros
jkindle at orxonox.net
jkindle at orxonox.net
Thu May 11 15:18:28 CEST 2017
Author: jkindle
Date: 2017-05-11 15:18:27 +0200 (Thu, 11 May 2017)
New Revision: 11416
Added:
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.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/SOB.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.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/SOBFlagstone.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.h
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.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/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 the animation for the level end (walk into castle), Coins for the blocks, Castleblocks and Flagblocks
Modified: code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw
===================================================================
--- code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw 2017-05-11 13:18:27 UTC (rev 11416)
@@ -25,8 +25,17 @@
</SOBMushroom>
</Template>
+ <Template name=coin defaults=0 >
+ <SOBCoin speed = 15 lifetime = 0.7>
+ <attached>
+ <Model mesh="Pilz.mesh" position="0,0,11" scale=3 pitch=90/>
+ </attached>
+
+ </SOBCoin>
+ </Template>
+
<Template name=sobfigurecameras defaults=0>
<SOBFigure>
<camerapositions>
@@ -71,14 +80,14 @@
<Scene ambientlight="1.0, 1.0, 1.0" 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" />
- <SpawnPoint position="991.729, -110.11, 435.404" orientation="0.534038, 0.563456, 0.212168, 0.593553" />
+ <SpawnPoint position="1984,-5,88 " orientation="0.534038, 0.563456, 0.212168, 0.593553" />
+<!-- 991.729, -110.11, 435.404
+-->
-
-
<MovableEntity >
<attached>
<SOBCenterpoint name=jumpcenter cameraOffset="10" figureTemplate=sobFigureTemplate>
@@ -117,7 +126,8 @@
- <SOBGumba collisionType="dynamic" speed=30>
+
+ <SOBGumba collisionType="dynamic" speed=30 position = "320,0,0">
<attached>
<Model mesh="Goomba.mesh" position="0,0,21" scale=3 pitch=90/>
@@ -152,7 +162,7 @@
<!-- 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="170,0,20" mass='-1'> <!-- L1.1 -->
+ <SOBQBlock collisionType="static" type="Coin" position="170,0,20" mass='-1'> <!-- L1.1 -->
<attached>
<Model mesh="QCube.mesh" scale=10 pitch=90 />
<Model mesh="QCube-grey.mesh" scale=10 pitch=90 visible=false/>
@@ -200,7 +210,7 @@
</SOBQBlock>
<Model mesh="Cube1.1.mesh" position="250,0,20" scale=10/> <!-- L1.7 -->
-<!-- Rohre-->
+ <!-- Rohre-->
<Model mesh="Rohr.mesh" position="295,5,-35" scale=10 pitch=90 /> <!-- L1.8 -->
<Model mesh="Rohr.mesh" position="395,5,-25" scale=10 pitch=90 /> <!-- L1.9 -->
<Model mesh="Rohr.mesh" position="475,5,-15" scale=10 pitch=90 /> <!-- L1.10 -->
@@ -243,7 +253,7 @@
<StaticEntity collisionType="static" >
<collisionShapes>
-
+
<BoxCollisionShape position="295,0,-4" halfExtents="12,5,12" /> <!-- 1.8 -->
<BoxCollisionShape position="395,0,1" halfExtents="12,5,17" /> <!-- 1.9 -->
<BoxCollisionShape position="475,0,6" halfExtents="12,5,22" /> <!-- 1.10 -->
@@ -522,16 +532,79 @@
-
+ <!-- FLAG -->
+ <SOBFlagstone points = 100 position="1990,0,10" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 200 position="1990,0,20" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 400 position="1990,0,30" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 800 position="1990,0,40" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 1600 position="1990,0,50" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 2200 position="1990,0,60" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 2700 position="1990,0,70" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 3400 position="1990,0,80" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
+ <SOBFlagstone points = 4000 position="1990,0,90" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBFlagstone>
-
+ <SOBCastlestone position="2060,0,-10" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBCastlestone>
+ <SOBCastlestone position="2050,40,-10" collisionType="static">
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="5,5,5" />
+ </collisionShapes>
+ </SOBCastlestone>
<StaticEntity collisionType="static" mass='-1'>
<collisionShapes>
+ <BoxCollisionShape position="2050,20,-20" halfExtents="5,20,5" />
+ </collisionShapes>
+ </StaticEntity>
+
+
+
+ <StaticEntity collisionType="static" mass='-1'>
+ <collisionShapes>
+
<BoxCollisionShape position="1690,0,20" halfExtents="5,5,5" /> <!-- 4.3 -->
<BoxCollisionShape position="1700,0,20" halfExtents="5,5,5" /> <!-- 4.4 -->
<BoxCollisionShape position="1720,0,20" halfExtents="5,5,5" /> <!-- 4.6 -->
@@ -562,9 +635,9 @@
<BoxCollisionShape position="1885,0,40" halfExtents="20,5,5" />
<BoxCollisionShape position="1890,0,50" halfExtents="15,5,5" />
<BoxCollisionShape position="1895,0,60" halfExtents="10,5,5" />
- <BoxCollisionShape position="1990,0,40" halfExtents="5,5,55" />
+ <!--<BoxCollisionShape position="1990,0,40" halfExtents="5,5,55" />
+-->
-
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt 2017-05-11 13:18:27 UTC (rev 11416)
@@ -9,6 +9,8 @@
SOBHUDInfo.cc
SOBGumba.cc
SOBFlagstone.cc
+ SOBCastlestone.cc
+ SOBCoin.cc
)
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,34 +20,32 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabian 'x3n' Landau
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
/**
- @file Pong.cc
- @brief Implementation of the Pong class.
+ @file SOB.cc
+ @brief Implementation of the SOB class.
*/
#include "SOB.h"
-
#include "core/CoreIncludes.h"
#include "core/EventIncludes.h"
#include "core/command/Executor.h"
#include "core/config/ConfigValueIncludes.h"
#include "core/Game.h"
-
#include "gamestates/GSLevel.h"
#include "chat/ChatManager.h"
#include "infos/PlayerInfo.h"
-
#include "SOBCenterpoint.h"
-
#include "SOBFigure.h"
#include "graphics/Camera.h"
+
+
namespace orxonox
{
@@ -88,6 +86,8 @@
camera = nullptr;
}
+
+
void SOB::start()
{
if (center_ != nullptr) // There needs to be a SOBCenterpoint, i.e. the area the game takes place.
@@ -94,9 +94,8 @@
{
if (figure_ == nullptr)
{
- figure_ = new SOBFigure(center_->getContext());
+ figure_ = new SOBFigure(center_->getContext()); //add a new instance of a player to the game
figure_->addTemplate(center_->getFigureTemplate());
- // figure_->InitializeAnimation(center_->getContext()); //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
}
center_->attach(figure_);
@@ -123,7 +122,6 @@
{
cleanup();
GSLevel::startMainMenu();
-
Deathmatch::end();
}
@@ -130,7 +128,7 @@
void SOB::restart() {
cleanup();
- // HACK
+ // HACK - only method I found to simply reload the level
Game::getInstance().popState();
Game::getInstance().popState();
Game::getInstance().requestStates("standalone, level");
@@ -143,7 +141,7 @@
if (figure_->getPlayer() == nullptr)
{
- player->startControl(figure_);
+ player->startControl(figure_); //Give the control of the instance player to the real person
players_[player].state_ = PlayerState::Alive;
}
}
@@ -164,12 +162,22 @@
{
SUPER(SOB, tick, dt);
- if (this->figure_ != nullptr && figure_->dead_) {
+ //If player has reached end of level
+ if (this->figure_ != nullptr && figure_->lvlEnded_) {
+ std::stringstream a;
+ a << "Nice! " << getPoints() << " Points. Press <Space> to restart";
+ info_ =a.str();
+
+ //If player has died
+ } else if (this->figure_ != nullptr && figure_->dead_) {
info_ = "Game over. Press <Space> to restart";
- orxout() << "DEED" << endl;
}
+ //Kill the player if time is up
+ if (this->figure_ != nullptr && timeLeft_ <= 0)
+ this->figure_->dead_ = true;
+ //The time on the HUD
timeLeft_-=dt*2.5;
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOB.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,16 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabian 'x3n' Landau
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
/**
- @file Pong.h
- @brief Declaration of the Pong class.
- @ingroup Pong
+ @file SOB.h
+ @brief Declaration of the SOB class.
*/
#ifndef _SOB_H__
@@ -36,9 +35,6 @@
#define _SOB_H__
#include "superorxobros/SOBPrereqs.h"
-
-#include "tools/Timer.h"
-
#include "gametypes/Deathmatch.h"
#include "SOBCenterpoint.h"
@@ -45,7 +41,6 @@
namespace orxonox
{
-
class _SOBExport SOB : public Deathmatch
{
public:
@@ -62,6 +57,8 @@
PlayerInfo* getPlayer() const;
void restart();
+
+ //Functions for points and coins
int getPoints() {
return points_;
}
@@ -78,6 +75,9 @@
void addGumba() {
points_+=100;
}
+ void addPoints(int poi) {
+ points_+=poi;
+ }
int getTimeLeft() {
return timeLeft_;
}
@@ -85,6 +85,9 @@
return info_;
}
+
+
+ //Not used yet - placed if somebody wants to develop lvl 1-2 etc
void setLvl(int lvl) {
lvl_ = lvl;
}
@@ -108,7 +111,7 @@
int points_;
int coins_;
float timeLeft_;
-
+
int lvl_;
std::string info_;
@@ -116,4 +119,4 @@
};
}
-#endif /* _Pong_H__ */
+#endif /* _SOB_H__ */
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.cc (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ * Julien Kindle
+ * Co-authors:
+ *
+ *
+ */
+
+/**
+ @file SOBCastlestone.cc
+ @brief Mainly used to guide the player into the castle after he has touched the flag and the control goes to the game
+*/
+
+#include "SOBCastlestone.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SOBFigure.h"
+#include "util/Output.h"
+
+
+namespace orxonox
+{
+ RegisterClass(SOBCastlestone);
+
+ SOBCastlestone::SOBCastlestone(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(SOBCastlestone);
+ setAngularFactor(0.0);
+ this->enableCollisionCallback();
+ hasCollided_=false;
+
+ }
+
+ bool SOBCastlestone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
+ return true;
+ }
+
+}
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.h (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCastlestone.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ * Julien Kindle
+ * Co-authors:
+ *
+ *
+ */
+
+/**
+ @file SOBCastlestone.h
+ @brief Declaration of the SOBCastlestone class.
+*/
+
+#ifndef _SOBCastlestone_H__
+#define _SOBCastlestone_H__
+
+#include "superorxobros/SOBPrereqs.h"
+#include "worldentities/StaticEntity.h"
+
+
+namespace orxonox
+{
+ class _SOBExport SOBCastlestone : public StaticEntity
+ {
+ public:
+ SOBCastlestone(Context* context);
+ virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
+ bool hasCollided_;
+
+ };
+}
+
+#endif /* _SOBCastlestone_H__ */
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
/**
@file SOBCenterpoint.cc
- @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the SOBCenterpoint.
+ @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame.
*/
#include "SOBCenterpoint.h"
@@ -44,9 +44,6 @@
SOBCenterpoint::SOBCenterpoint(Context* context) : StaticEntity(context)
{
RegisterObject(SOBCenterpoint);
-
-
-
checkGametype();
}
@@ -55,6 +52,7 @@
SUPER(SOBCenterpoint, XMLPort, xmlelement, mode);
+
XMLPortParam(SOBCenterpoint, "cameraOffset", setCameraOffset, getCameraOffset, xmlelement, mode);
XMLPortParam(SOBCenterpoint, "figureTemplate", setFigureTemplate, getFigureTemplate, xmlelement, mode);
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCenterpoint.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -37,7 +37,7 @@
/**
@brief
- @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. All platforms, enemies and items are attached to the SOBCenterpoint.
+ @brief The SOBCenterpoint is a StaticEntity which represents the level of the minigame. Everybody used it so I used it too, do not ask my why..
*/
class _SOBExport SOBCenterpoint : public StaticEntity
{
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.cc (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -0,0 +1,83 @@
+/*
+ * 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:
+ * Julien Kindle
+ * Co-authors:
+ *
+ *
+ */
+
+/**
+ @file SOBCoin.cc
+ @brief This is the object that appears when player hits a QBlock with type coin - it should be a coin floating ontop of the QBlock
+*/
+
+#include "SOBCoin.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SOBFigure.h"
+#include "util/Output.h"
+
+
+namespace orxonox
+{
+ RegisterClass(SOBCoin);
+
+ SOBCoin::SOBCoin(Context* context) : MovableEntity(context)
+ {
+ RegisterObject(SOBCoin);
+ setAngularFactor(0.0);
+
+ }
+
+
+ void SOBCoin::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(SOBCoin, XMLPort, xmlelement, mode);
+ XMLPortParam(SOBCoin, "lifetime", setLifetime, getLifetime, xmlelement, mode);
+ XMLPortParam(SOBCoin, "speed", setSpeed, getSpeed, xmlelement, mode);
+
+ }
+
+
+ void SOBCoin::tick(float dt)
+ {
+ SUPER(SOBCoin, tick, dt);
+
+ lifetime_-=dt;
+
+ if (lifetime_ <+ 0) {
+ destroyLater();
+ }
+
+ Vector3 velocity = getVelocity();
+ velocity.z = speed_;
+
+ setVelocity(velocity);
+
+
+
+ }
+
+
+}
Added: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.h (rev 0)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBCoin.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -0,0 +1,72 @@
+/*
+ * 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:
+ * Julien Kindle
+ * Co-authors:
+ *
+ *
+ */
+
+/**
+ @file SOBCoin.h
+ @brief Declaration of the SOBCoin class.
+ @ingroup SOB
+*/
+
+#ifndef _SOBCoin_H__
+#define _SOBCoin_H__
+
+#include "superorxobros/SOBPrereqs.h"
+#include "worldentities/MovableEntity.h"
+
+
+namespace orxonox
+{
+ class _SOBExport SOBCoin : public MovableEntity
+ {
+ public:
+ SOBCoin(Context* context);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+ virtual void tick(float dt) override;
+
+
+ bool attachedToFigure_;
+
+ void setLifetime(const float lt)
+ { this->lifetime_ = lt; }
+ float getLifetime() const
+ { return lifetime_; }
+ void setSpeed(const float lt)
+ { this->speed_ = lt; }
+ float getSpeed() const
+ { return speed_; }
+
+
+ protected:
+
+ float lifetime_;
+ float speed_;
+
+ };
+}
+
+#endif /* _SOBCoin_H__ */
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -43,6 +43,7 @@
#include "SOBGumba.h"
#include "SOB.h"
#include "SOBFlagstone.h"
+#include "SOBCastlestone.h"
namespace orxonox
{
@@ -53,26 +54,35 @@
RegisterObject(SOBFigure);
// initialize variables
+ gravityAcceleration_ = 350.0;
+ //Vars for movement of player
moveUpPressed_ = false;
moveDownPressed_ = false;
moveLeftPressed_ = false;
moveDownPressed_ = false;
firePressed_ = false;
+
+ //Times and turning
timeSinceLastFire_ = 0.0;
lastSpeed_z = 0.0;
+ pitch_ = 0.0;
+ timeCounter_ = 0;
+
+ //Properties of player
+ gotPowerUp_ = false;
isColliding_ = true;
particlespawner_ = NULL;
- gravityAcceleration_ = 350.0;
- pitch_ = 0.0;
-
+ //Properties of players life
predead_ = false;
dead_ = false;
- gotPowerUp_ = false;
+ lvlEnded_ = false;
+ reachedLvlEndState_ = 0;
+
- setAngularFactor(0.0);
- this->enableCollisionCallback();
+ setAngularFactor(0.0); //Means player doesn't turn on collision, so he doesn't fall over while walking over the ground
+ this->enableCollisionCallback(); // Turns on that on every collision function collidesAgainst is executed
}
@@ -80,19 +90,25 @@
bool SOBFigure::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
isColliding_ = true;
+
+ //Orxocast returns object with casted type if otherObject has that class, and if not a nullptr
SOBMushroom* mush = orxonox_cast<SOBMushroom*>(otherObject);
SOBGumba* gumba = orxonox_cast<SOBGumba*>(otherObject);
SOBFlagstone* flagstone = orxonox_cast<SOBFlagstone*>(otherObject);
+ SOBCastlestone* castlestone = orxonox_cast<SOBCastlestone*>(otherObject);
+ //Check if otherObject is a powerup
if (mush != nullptr && !(mush->hasCollided_)) {
otherObject->destroyLater();
gotPowerUp_ = true;
- SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
- SOBGame->addMushroom();
- mush->hasCollided_ = true;
+ SOB* SOBGame = orxonox_cast<SOB*>(getGametype()); //Get the Gametype
+ SOBGame->addMushroom(); // Tell the gametype to increase points
+ mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once
+ //Check if otherObject is a Gumba (that walking enemies)
} else if (gumba != nullptr && !(gumba->hasCollided_)) {
+ //If player jumps on its head, kill it, else, kill the player
if (getVelocity().z >= -20) {
Vector3 vel = getVelocity();
vel.y = -80;
@@ -99,6 +115,7 @@
vel.z = 200;
setVelocity(vel);
predead_=true;
+
} else {
gumba->destroyLater();
gumba->hasCollided_ = true;
@@ -109,108 +126,125 @@
}
}
- if (flagstone != nullptr && !(flagstone->hasCollided_)) {
- flagstone->hasCollided_ = true;
+ //Purpose is that if player hits the flag, he should walk into the castle at the end of the level. For that we use SOBCastlestone
+ if (reachedLvlEndState_ == 0 && flagstone != nullptr && !(flagstone->hasCollided_)) {
+ flagstone->hasCollided_ = true;
+ reachedLvlEndState_ = 1;
+ SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+ SOBGame->addPoints(flagstone->getPoints());
- }
+ }
+ if (castlestone != nullptr && !(castlestone->hasCollided_)) {
+ castlestone->hasCollided_ = true;
+ reachedLvlEndState_++;
+ }
+
return true;
}
-
-void SOBFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-{
- SUPER(SOBFigure, XMLPort, xmlelement, mode);
-
-}
-
-
+//Self implemented sign function that returns either 1 or -1 (and never 0)
int SOBFigure::sgn(float x) {
-
if (x < 0.0) return -1;
return 1;
}
+//For those of you who don't have an idea: the tick function is called about 50 times/sec
void SOBFigure::tick(float dt)
{
SUPER(SOBFigure, tick, dt);
+
+ bool inputAllowed = true;
+
+ //the particle spawner that generates the fire from the backpack when pressed
if (particlespawner_ == NULL) {
for (WorldEntity* object : this->getAttachedObjects())
{
- if (object->isA(Class(ParticleSpawner)))
+ if (object->isA(Class(ParticleSpawner)))
particlespawner_ = object;
-
+ }
}
-}
+ //Behavior on level end - this is like described above for the movement from the player when hit the flag. He moves then into the castle
+ if (reachedLvlEndState_ != 0) {
+ timeCounter_+= dt;
+ inputAllowed = false;
+ }
+ if (reachedLvlEndState_ == 1 && timeCounter_ >= 1.5) {
+ timeCounter_ = 0;
+ reachedLvlEndState_ = 2;
+ }
+ //if input blocked, then cancel every movement operation
+ if (!inputAllowed) {
+ moveUpPressed_ = false;
+ moveDownPressed_ = false;
+ moveLeftPressed_ = false;
+ moveRightPressed_ = false;
+ }
+ //set the gravityto standard 350
+ if (firePressed_ == false) {
+ gravityAcceleration_ = 350.0;
+ }
-if (firePressed_ == false) {
- gravityAcceleration_ = 350.0;
+ if (hasLocalController())
+ {
+ Vector3 velocity = getVelocity();
+ Vector3 position = getPosition();
-}
+ if (!predead_)
+ velocity.y = 0;
+ if (position.z < -100) {
+ dead_ = true;
+ }
-if (hasLocalController())
-{
- Vector3 velocity = getVelocity();
- Vector3 position = getPosition();
- if (!predead_)
- velocity.y = 0;
-if (position.z < -100) {
- dead_ = true;
+ if (dead_) {
+ velocity.x = 0;
+ velocity.z = 0;
+ setVelocity(velocity);
+ SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+ if (firePressed_)
+ SOBGame->restart();
+ return;
+ }
-}
-if (dead_) {
- velocity.x = 0;
- velocity.z = 0;
- setVelocity(velocity);
- SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
- if (firePressed_)
- SOBGame->restart();
- return;
-}
+ int maxvelocity_x = 100;
+ int speedAddedPerTick = 5;
+ int camMaxOffset = 25;
+ 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);
- //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_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
- gravityAcceleration_ = 100.0;
+ if (inputAllowed && 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();
- orxout() << rot << endl;
if (moveRightPressed_) {
if (!(rot < 5.0 && -5.0 < rot))
setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() - sgn(rot)*dt*Radian(6));
-
if (std::abs(velocity.x) < maxvelocity_x) {
velocity.x += speedAddedPerTick;
@@ -229,11 +263,26 @@
}
+ //Again another EndOfLevel behavior
+ if (reachedLvlEndState_ == 1)
+ velocity.x = -2;
+ if (reachedLvlEndState_ == 2)
+ velocity.x = 30;
+ if (reachedLvlEndState_ == 3) {
+ velocity.x = 0;
+ velocity.y = 20;
+ }
+ if (reachedLvlEndState_ == 4) {
+ lvlEnded_ = true;
+ dead_ = true;
+ }
+
+ //velocity = acc. * time
velocity.z -= gravityAcceleration_*dt;
setVelocity(velocity);
- //Camera operation
+ //Camera operation - the camera should always follow the player in a specific region
Camera* cam = getCamera();
Vector3 campos = cam->getPosition();
@@ -251,16 +300,14 @@
}
- // Move through the left and right screen boundaries
- //setPosition(position);
- // Reset key variables
+ // Reset key variables
moveUpPressed_ = false;
moveDownPressed_ = false;
moveLeftPressed_ = false;
moveRightPressed_ = false;
- moveDownPressed_ = false;
+
isColliding_ = false;
}
@@ -269,7 +316,7 @@
-
+//The following functions read the input of the player and then set the bools for the movement
void SOBFigure::moveFrontBack(const Vector2& value)
{
if (value.x > 0)
@@ -298,12 +345,10 @@
}
}
-
-
-
-
void SOBFigure::boost(bool boost)
{
firePressed_ = boost;
}
+
+
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -40,26 +40,19 @@
public:
SOBFigure(Context* context); //!< Constructor. Registers and initializes the object.
virtual ~SOBFigure() {}
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
virtual void tick(float dt) override;
virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the figure up and down.
virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the figure up and down.
-
-
virtual void boost(bool boost) override;
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
-
- //virtual void CollisionWithEnemy(SOBEnemy* enemy);
-
-
-
-
bool dead_;
bool predead_;
+ bool lvlEnded_;
private:
+ //Soooo many declarations
bool gotPowerUp_;
bool moveUpPressed_;
bool moveDownPressed_;
@@ -74,6 +67,8 @@
bool isColliding_;
WorldEntity* particlespawner_;
int sgn(float x);
+ int reachedLvlEndState_;
+ float timeCounter_;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien
* Co-authors:
- * ...
+ *
*
*/
/**
@file SOBFlagstone.cc
- @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
+ @brief The flagstone, as described in the h file
*/
#include "SOBFlagstone.h"
@@ -43,16 +43,16 @@
{
RegisterClass(SOBFlagstone);
- SOBFlagstone::SOBFlagstone(Context* context) : MovableEntity(context)
+ SOBFlagstone::SOBFlagstone(Context* context) : StaticEntity(context)
{
RegisterObject(SOBFlagstone);
setAngularFactor(0.0);
this->enableCollisionCallback();
-
+
hasCollided_=false;
-
+
}
@@ -63,20 +63,17 @@
XMLPortParam(SOBFlagstone, "points", setPoints, getPoints, xmlelement, mode);
- }
+ }
-
+
bool SOBFlagstone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
-
-
-orxout() << "Watshc bum baem" << otherObject->getMass()<< endl;
-return true;
+ return true;
}
-
+
-
+
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFlagstone.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
/**
@file SOBFlagstone.h
- @brief Declaration of the SOBFlagstone class.
+ @brief Declaration of the SOBFlagstone class. This class is used for the flag - for everz 10x10x10 stone we added a flagstone with different points. The higher you touch the flag, the more points you get.
@ingroup SOB
*/
@@ -36,12 +36,12 @@
#define _SOBFlagstone_H__
#include "superorxobros/SOBPrereqs.h"
-#include "worldentities/MovableEntity.h"
+#include "worldentities/StaticEntity.h"
namespace orxonox
{
- class _SOBExport SOBFlagstone : public MovableEntity
+ class _SOBExport SOBFlagstone : public StaticEntity
{
public:
SOBFlagstone(Context* context);
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -75,7 +75,7 @@
bool SOBGumba::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
-
+ //Every object with mass -1 does not change the direction of the Gumba. For example the ground floor! The other objects switch the direction of the gumba.
if (changeAllowed_ && otherObject->getMass() != -1) {
goesRight_ = !goesRight_;
changeAllowed_ = false;
@@ -90,10 +90,7 @@
figure_ = newFigure;
}
- void SOBGumba::touchFigure()
- {
- }
void SOBGumba::tick(float dt)
{
@@ -101,7 +98,8 @@
if (!changeAllowed_) {
changedOn_+= dt;
- if (changedOn_> 200) {
+ // After a collision, we don't listen for collisions for 200ms - that's because one wall can cause several collisions!
+ if (changedOn_> 0.200) {
changeAllowed_ = true;
changedOn_ = 0.0;
@@ -118,85 +116,8 @@
velocity.x = dir*speed_;
setVelocity(velocity);
-
-
lastPos_ = getPosition();
}
}
-/*
- * 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 SOBGumba.h
- @brief Declaration of the SOBGumba class.
- @ingroup SOB
-*/
-
-#ifndef _SOBGumba_H__
-#define _SOBGumba_H__
-
-#include "superorxobros/SOBPrereqs.h"
-#include "worldentities/MovableEntity.h"
-
-
-namespace orxonox
-{
- class _SOBExport SOBGumba : public MovableEntity
- {
- public:
- SOBGumba(Context* context);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
- virtual void setFigure(SOBFigure* newFigure);
- virtual void touchFigure();
- virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
- virtual void tick(float dt) override;
-
-
- bool attachedToFigure_;
-
- void setSpeed(const float speed)
- { this->speed_ = speed; }
- float getSpeed() const
- { return speed_; }
-
- bool hasCollided_;
- protected:
- float gravityAcceleration_;
- float speed_;
- WeakPtr<SOBFigure> figure_;
- bool goesRight_;
- Vector3 lastPos_;
- bool changeAllowed_;
- float changedOn_;
-
- };
-}
-
-#endif /* _SOBGumba_H__ */
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBGumba.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
/**
@file SOBGumba.h
- @brief Declaration of the SOBGumba class.
+ @brief Declaration of the SOBGumba class. Gumbas are the enemie mushrooms - pretty sure it's written Goomba but, naaah
@ingroup SOB
*/
@@ -47,7 +47,6 @@
SOBGumba(Context* context);
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
virtual void setFigure(SOBFigure* newFigure);
- virtual void touchFigure();
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
virtual void tick(float dt) override;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Florian Zinggeler
+ * Julien Kindle
*
*/
@@ -59,14 +59,12 @@
{
SUPER(SOBHUDInfo, tick, dt);
+ //If you have a look at the HUD xml file, you can see there are several elements with different types.
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!");
+ if (this->type_ == "Coins") {
-
std::stringstream ss;
ss << "cc x " << std::setw(2) << std::setfill('0') << SOBGame->getCoins();
std::string s = ss.str();
@@ -98,6 +96,7 @@
}
}
+//No idea why, just implement this method
void SOBHUDInfo::changedOwner()
{
SUPER(SOBHUDInfo, changedOwner);
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBHUDInfo.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Florian Zinggeler
+ * Julien Kindle
*
*/
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
/**
@file SOBItem.cc
- @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
+ @brief Not sure if ever used
*/
#include "SOBItem.h"
@@ -66,8 +66,7 @@
bool SOBItem::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
-//orxout() << "Watshc bum baem" << endl;
-return true;
+ return true;
}
@@ -76,8 +75,5 @@
figure_ = newFigure;
}
- void SOBItem::touchFigure()
- {
- }
}
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -47,7 +47,6 @@
SOBItem(Context* context);
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
virtual void setFigure(SOBFigure* newFigure);
- virtual void touchFigure();
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
/**
@file SOBMushroom.cc
- @brief All items in this minigame inherit from this class. Items can move around like platforms and enemies.
+ @brief This is the class for the powerup mushroom
*/
#include "SOBMushroom.h"
@@ -76,13 +76,12 @@
bool SOBMushroom::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
-if (changeAllowed_ && otherObject->getMass() != -1) {
+ if (changeAllowed_ && otherObject->getMass() != -1) {
goesRight_ = !goesRight_;
changeAllowed_ = false;
-}
+ }
-orxout() << "Watshc bum baem" << otherObject->getMass()<< endl;
-return true;
+ return true;
}
@@ -91,18 +90,16 @@
figure_ = newFigure;
}
- void SOBMushroom::touchFigure()
- {
- }
void SOBMushroom::tick(float dt)
{
SUPER(SOBMushroom, tick, dt);
+ //Exactly like the Gumba class, if collided, turn direction of Mushroom and wait 200ms so we don't get two collisions from the same wall
if (!changeAllowed_) {
changedOn_+= dt;
- if (changedOn_> 200) {
+ if (changedOn_> 0.200) {
changeAllowed_ = true;
changedOn_ = 0.0;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBMushroom.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -47,7 +47,6 @@
SOBMushroom(Context* context);
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
virtual void setFigure(SOBFigure* newFigure);
- virtual void touchFigure();
virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
virtual void tick(float dt) override;
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Reto Grieder
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -29,7 +29,7 @@
/**
@file
@brief
- Shared library macros, enums, constants and forward declarations for the pong module
+ Shared library macros, enums, constants and forward declarations for the SOB module
*/
#ifndef _SOBPrereqs_H__
@@ -67,13 +67,7 @@
namespace orxonox
{
- /* class Pong;
- class PongAI;
- class PongBall;
- class PongBat;
- class PongBot;*/
class SOBCenterpoint;
-
class SOB;
class SOBFigure;
class SOBItem;
@@ -82,8 +76,9 @@
class SOBHUDInfo;
class SOBGumba;
class SOBFlagstone;
- /*
- class PongScore;*/
+ class SOBCastlestone;
+ class SOBCoin;
+
}
#endif /* _SOBPrereqs_H__ */
Modified: code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc
===================================================================
--- code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc 2017-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.cc 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -37,6 +37,7 @@
#include "core/XMLPort.h"
#include "SOB.h"
#include "SOBMushroom.h"
+#include "SOBCoin.h"
namespace orxonox
{
@@ -46,11 +47,7 @@
{
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()
@@ -61,6 +58,8 @@
bool SOBQBlock::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
+
+ //If you hit the QBlock, the visibility of all attached objects get inverted! Pretty easy way to create changing blocks :)
float v_z = otherObject->getVelocity().z;
if (!used_ && v_z > 50.0) {
used_ = true;
@@ -69,8 +68,12 @@
object->setVisible(!object->isVisible());
SOB* SOBGame = orxonox_cast<SOB*>(getGametype());
+
+ //Spawn either a powerup mushroom or a coin animation (also just an object, have a look at the SOBCoin class)
+ //The spawn methods are declared at the bottom of this file
if (type_ == "Coin") {
SOBGame->addCoin();
+ spawnCoin();
}
if (type_ == "Mushroom") {
spawnMushroom();
@@ -90,6 +93,7 @@
}
+ //The spawnmethods from above
void SOBQBlock::spawnMushroom() {
SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
@@ -100,14 +104,23 @@
if (mush != nullptr && center_ != nullptr)
{
mush->addTemplate("mushroom");
-
+ mush->setPosition(spawnpos);
+
+ }
+ }
+ void SOBQBlock::spawnCoin() {
+ SOBCenterpoint* center_ = ((SOB*)getGametype())->center_;
- //newBoots->addTemplate(center_->getBootsTemplate());
+ SOBCoin* mush = new SOBCoin(center_->getContext());
+ Vector3 spawnpos = this->getWorldPosition();
+ spawnpos.z += 0;
+
+ if (mush != nullptr && center_ != nullptr)
+ {
+ mush->addTemplate("coin");
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-05-11 13:04:50 UTC (rev 11415)
+++ code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBQBlock.h 2017-05-11 13:18:27 UTC (rev 11416)
@@ -20,9 +20,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabien Vultier
+ * Julien Kindle
* Co-authors:
- * ...
+ *
*
*/
@@ -52,6 +52,7 @@
bool used_;
std::string type_;
void spawnMushroom();
+ void spawnCoin();
};
}
More information about the Orxonox-commit
mailing list