[Orxonox-commit 5342] r10005 - in code/branches/pickupsFS14: data/levels src/modules src/modules/jump
fvultier at orxonox.net
fvultier at orxonox.net
Thu Mar 27 14:10:13 CET 2014
Author: fvultier
Date: 2014-03-27 14:10:12 +0100 (Thu, 27 Mar 2014)
New Revision: 10005
Added:
code/branches/pickupsFS14/data/levels/Jump.oxw
code/branches/pickupsFS14/src/modules/jump/
code/branches/pickupsFS14/src/modules/jump/CMakeLists.txt
code/branches/pickupsFS14/src/modules/jump/Jump.cc
code/branches/pickupsFS14/src/modules/jump/Jump.h
code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.cc
code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.h
code/branches/pickupsFS14/src/modules/jump/JumpPrereqs.h
code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
code/branches/pickupsFS14/src/modules/jump/JumpShip.h
Modified:
code/branches/pickupsFS14/src/modules/CMakeLists.txt
Log:
Initial checkin
Added: code/branches/pickupsFS14/data/levels/Jump.oxw
===================================================================
--- code/branches/pickupsFS14/data/levels/Jump.oxw (rev 0)
+++ code/branches/pickupsFS14/data/levels/Jump.oxw 2014-03-27 13:10:12 UTC (rev 10005)
@@ -0,0 +1,81 @@
+<LevelInfo
+ name = "Jump"
+ description = "Jump\nTip: Try to keep the multiplier high by avoiding shots and enemies."
+ tags = "minigame"
+ screenshot = "orxonoxArcade.png"
+/>
+<?lua
+ include("stats.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff2.oxt")
+ include("templates/spaceshipPirate.oxt")
+ include("templates/spaceshipInvader.oxt")
+ include("templates/enemyInvader.oxt")
+ include("overlays/InvaderHUD.oxo")
+?>
+
+<Level gametype = Jump>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <!-- ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox" -->
+ <Scene ambientlight = "0.8, 0.7, 0.4" skybox = "Orxonox/skyBoxBasic">
+
+
+ <WorldAmbientSound
+ source="Earth.ogg"
+ looping="true"
+ playOnLoad="true"
+ />
+
+
+ <!-- <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"/> -->
+ <Light type=directional position="1100, 11000, -7000" lookat="0, 0, 0" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+
+
+
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=JumpShip pawndesign=spaceshipinvader />
+<!--
+ <DistanceTrigger name="start" position="-200,0,0" target="Pawn" distance=10 stayActive="true" delay=0 />
+
+
+ <JumpCenterPoint name=jumpcenter />
+
+
+ <?lua
+ for i = 1, 300, 1 do
+ j = math.random()
+ ?>
+
+ <MovableEntity
+ position = "<?lua print(math.random()* 40000 + 1000) ?>,-1000,<?lua print(math.random() * 4000 - 2000) ?>"
+ collisionType = dynamic
+ linearDamping = 0.8
+ angularDamping = 0
+ scale = "<?lua print(j * 150)?>"
+ collisiondamage = 0
+ enablecollisiondamage = true
+ >
+ <attached>
+ <Model mass="<?lua print(j * 1000) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 350) ?>" />
+ </collisionShapes>
+ </MovableEntity>
+
+ <?lua
+ end
+ ?>
+
+ -->
+
+ </Scene>
+</Level>
+
Modified: code/branches/pickupsFS14/src/modules/CMakeLists.txt
===================================================================
--- code/branches/pickupsFS14/src/modules/CMakeLists.txt 2014-03-27 12:36:50 UTC (rev 10004)
+++ code/branches/pickupsFS14/src/modules/CMakeLists.txt 2014-03-27 13:10:12 UTC (rev 10005)
@@ -39,3 +39,4 @@
ADD_SUBDIRECTORY(docking)
ADD_SUBDIRECTORY(towerdefense)
ADD_SUBDIRECTORY(invader)
+ADD_SUBDIRECTORY(jump)
Added: code/branches/pickupsFS14/src/modules/jump/CMakeLists.txt
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/CMakeLists.txt (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/CMakeLists.txt 2014-03-27 13:10:12 UTC (rev 10005)
@@ -0,0 +1,17 @@
+SET_SOURCE_FILES(Jump_SRC_FILES
+BUILD_UNIT JumpBuildUnit.cc
+ Jump.cc
+ JumpCenterPoint.cc
+ JumpShip.cc
+END_BUILD_UNIT
+)
+
+ORXONOX_ADD_LIBRARY(jump
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ overlays
+ weapons
+ SOURCE_FILES ${Jump_SRC_FILES}
+)
Added: code/branches/pickupsFS14/src/modules/jump/Jump.cc
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/Jump.cc (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/Jump.cc 2014-03-27 13:10:12 UTC (rev 10005)
@@ -0,0 +1,192 @@
+/*
+ * 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
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Jump.cc
+ @brief Implementation of the Jump class.
+*/
+
+#include "Jump.h"
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/command/Executor.h"
+#include "core/config/ConfigValueIncludes.h"
+
+#include "gamestates/GSLevel.h"
+#include "chat/ChatManager.h"
+
+// ! HACK
+#include "infos/PlayerInfo.h"
+
+#include "JumpCenterPoint.h"
+#include "JumpShip.h"
+/*
+#include "JumpEnemy.h"
+#include "JumpEnemyShooter.h"*/
+
+#include "core/command/ConsoleCommand.h"
+#include "worldentities/BigExplosion.h"
+
+namespace orxonox
+{
+ RegisterUnloadableClass(Jump);
+
+ Jump::Jump(Context* context) : Deathmatch(context)
+ {
+ RegisterObject(Jump);
+ //this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
+ //this->center_ = 0;
+ // init();
+ //this->setHUDTemplate("JumpHUD");
+ }
+
+ void Jump::init()
+ {
+ /*bEndGame = false;
+ lives = 3;
+ level = 1;
+ point = 0;
+ bShowLevel = false;
+ multiplier = 1;
+ b_combo = false;*/
+ // spawn enemy every 3.5 seconds
+ //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Jump::spawnEnemy, this)));
+ //comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&Jump::comboControll, this)));
+ }
+
+ /*void Jump::levelUp()
+ {
+ level++;
+ if (getPlayer() != NULL)
+ {
+ for (int i = 0; i < 7; i++)
+ {
+ WeakPtr<BigExplosion> chunk = new BigExplosion(this->center_->getContext());
+ chunk->setPosition(Vector3(600, 0, 100.f * i - 300));
+ chunk->setVelocity(Vector3(1000, 0, 0)); //player->getVelocity()
+ chunk->setScale(20);
+ }
+ }
+ addPoints(multiplier * 42);
+ multiplier *= 2;
+ toggleShowLevel();
+ showLevelTimer.setTimer(1.0f, false, createExecutor(createFunctor(&Jump::toggleShowLevel, this)));
+ }*/
+
+ WeakPtr<JumpShip> Jump::getPlayer()
+ {
+ if (player == NULL)
+ {
+ ObjectList<JumpShip>::iterator it;
+ it = ObjectList<JumpShip>::begin();
+ /*for (ObjectList<JumpShip>::iterator it = ObjectList<JumpShip>::begin(); it != ObjectList<JumpShip>::end(); ++it)
+ {
+ player = *it;
+ }*/
+ }
+ return player;
+ }
+
+ /*void Jump::spawnEnemy()
+ {
+ if (getPlayer() == NULL)
+ return;
+
+ for (int i = 0; i < (3*log10(static_cast<double>(level)) + 1); i++)
+ {
+ WeakPtr<JumpEnemy> newPawn;
+ if (rand() % 42/(1 + level*level) == 0)
+ {
+ newPawn = new JumpEnemyShooter(this->center_->getContext());
+ newPawn->addTemplate("enemyjumpshooter");
+ }
+ else
+ {
+ newPawn = new JumpEnemy(this->center_->getContext());
+ newPawn->addTemplate("enemyjump");
+ }
+ newPawn->setPlayer(player);
+ newPawn->level = level;
+ // spawn enemy at random points in front of player.
+ newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200));
+ }
+ }*/
+
+ /*void Jump::costLife()
+ {
+ lives--;
+ multiplier = 1;
+ // end the game in 30 seconds.
+ if (lives <= 0)
+ enemySpawnTimer.setTimer(30.0f, false, createExecutor(createFunctor(&Jump::end, this)));
+ };*/
+
+ /*void Jump::comboControll()
+ {
+ if (b_combo)
+ multiplier++;
+ // if no combo was performed before, reset multiplier
+ else
+ multiplier = 1;
+ b_combo = false;
+ }*/
+
+ /*void Jump::start()
+ {
+ init();
+ // Set variable to temporarily force the player to spawn.
+ this->bForceSpawn_ = true;
+
+ if (this->center_ == NULL) // abandon mission!
+ {
+ orxout(internal_error) << "Jump: No Centerpoint specified." << endl;
+ GSLevel::startMainMenu();
+ return;
+ }
+ // Call start for the parent class.
+ Deathmatch::start();
+ }*/
+
+ /*void Jump::addPoints(int numPoints)
+ {
+ if (!bEndGame)
+ {
+ point += numPoints * multiplier;
+ b_combo = true;
+ }
+ }*/
+
+ /*void Jump::end()
+ {
+ // DON'T CALL THIS!
+ // Deathmatch::end();
+ // It will misteriously crash the game!
+ // Instead startMainMenu, this won't crash.
+ GSLevel::startMainMenu();
+ }*/
+}
Added: code/branches/pickupsFS14/src/modules/jump/Jump.h
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/Jump.h (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/Jump.h 2014-03-27 13:10:12 UTC (rev 10005)
@@ -0,0 +1,93 @@
+/*
+ * 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
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Jump.h
+ @brief Gametype.
+ @ingroup Jump
+*/
+
+#ifndef _Jump_H__
+#define _Jump_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "gametypes/Deathmatch.h"
+
+#include "JumpCenterPoint.h"
+
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+
+ class _JumpExport Jump : public Deathmatch
+ {
+ public:
+ Jump(Context* context);
+
+ //virtual void start();
+ //virtual void end();
+ //virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command
+
+ //void spawnEnemy();
+
+ void setCenterpoint(JumpCenterPoint* center){ this->center_ = center; }
+
+ /*int getLives(){return this->lives;}
+ int getLevel(){return this->level;}
+ int getPoints(){return this->point;}
+ int getMultiplier(){return this->multiplier;}*/
+
+ /*void costLife();
+ void levelUp();
+ void addPoints(int numPoints);
+ // checks if multiplier should be reset.
+ void comboControll();*/
+ void init();
+ //int lives;
+ //int multiplier;
+ //bool bEndGame;
+ //bool bShowLevel;
+ private:
+ //void toggleShowLevel(){bShowLevel = !bShowLevel;}
+ WeakPtr<JumpShip> getPlayer();
+ WeakPtr<JumpCenterPoint> center_;
+ WeakPtr<JumpShip> player;
+
+ /*Timer enemySpawnTimer;
+ Timer comboTimer;
+ Timer showLevelTimer;
+ //Context* context; <-- War schon auskommentiert!!!
+ int level;
+ int point;
+ bool b_combo;*/
+ };
+}
+
+#endif /* _Jump_H__ */
Added: code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.cc
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.cc (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.cc 2014-03-27 13:10:12 UTC (rev 10005)
@@ -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:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpCenterPoint.cc
+ @brief Implementation of the JumpCenterPoint class.
+*/
+
+#include "JumpCenterPoint.h"
+
+#include "core/CoreIncludes.h"
+
+#include "Jump.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpCenterPoint);
+
+ JumpCenterPoint::JumpCenterPoint(Context* context) : StaticEntity(context)
+ {
+ RegisterObject(JumpCenterPoint);
+
+ this->checkGametype();
+ }
+
+ void JumpCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(JumpCenterPoint, XMLPort, xmlelement, mode);
+ }
+
+ void JumpCenterPoint::changedGametype()
+ {
+ SUPER(JumpCenterPoint, changedGametype);
+
+ // Check, whether it's still Jump.
+ this->checkGametype();
+ }
+
+ void JumpCenterPoint::checkGametype()
+ {
+ if (this->getGametype() != NULL && this->getGametype()->isA(Class(Jump)))
+ {
+ Jump* jumpGametype = orxonox_cast<Jump*>(this->getGametype().get());
+ jumpGametype->setCenterpoint(this);
+ }
+ }
+}
Added: code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.h
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.h (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/JumpCenterPoint.h 2014-03-27 13:10:12 UTC (rev 10005)
@@ -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
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpCenterPoint.h
+ @brief Declaration of the JumpCenterPoint class.
+ @ingroup Jump
+*/
+
+#ifndef _JumpCenterPoint_H__
+#define _JumpCenterPoint_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpCenterPoint : public StaticEntity
+ {
+ public:
+ JumpCenterPoint(Context* context); //checks whether the gametype is actually Jump.
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void changedGametype(); //!< Is called when the gametype has changed.
+ private:
+ void checkGametype();
+
+ };
+}
+
+#endif /* _JumpCenterPoint_H__ */
Added: code/branches/pickupsFS14/src/modules/jump/JumpPrereqs.h
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpPrereqs.h (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/JumpPrereqs.h 2014-03-27 13:10:12 UTC (rev 10005)
@@ -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:
+ * Florian Zinggeler
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the Invader module
+*/
+
+#ifndef _JumpPrereqs_H__
+#define _JumpPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(INVADER_STATIC_BUILD)
+# ifdef INVADER_SHARED_BUILD
+# define _JumpExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _JumpExport
+# else
+# define _JumpExport __declspec(dllimport)
+# endif
+# endif
+# define _JumpPrivate
+#elif defined (ORXONOX_GCC_VISIBILITY)
+# define _JumpExport __attribute__ ((visibility("default")))
+# define _JumpPrivate __attribute__ ((visibility("hidden")))
+#else
+# define _JumpExport
+# define _JumpPrivate
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class Jump;
+ class JumpCenterPoint;
+ class JumpShip;
+ class JumpEnemy;
+ class JumpEnemyShooter;
+ class JumpWeapon;
+ class JumpWeaponEnemy;
+ class JumpHUDinfo;
+}
+
+#endif /* _JumpPrereqs_H__ */
Added: code/branches/pickupsFS14/src/modules/jump/JumpShip.cc
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpShip.cc (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/JumpShip.cc 2014-03-27 13:10:12 UTC (rev 10005)
@@ -0,0 +1,221 @@
+/*
+ * 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
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpShip.cc
+ @brief Implementation of the JumpShip class.
+*/
+
+#include "JumpShip.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "Jump.h"
+
+namespace orxonox
+{
+ RegisterClass(JumpShip);
+
+ JumpShip::JumpShip(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(JumpShip);
+
+ //speed = 500;
+ //isFireing = false;
+ //damping = 10;
+ left = false;
+ right = false;
+
+ }
+
+ void JumpShip::tick(float dt)
+ {
+
+ Vector3 pos = getPosition();
+
+ /*
+ //Movement calculation
+ lastTimeFront += dt * damping;
+ lastTimeLeft += dt * damping;
+ lastTime += dt;
+
+ velocity.x = interpolate(clamp(lastTimeLeft, 0.0f, 1.0f), desiredVelocity.x, 0.0f);
+ velocity.y = interpolate(clamp(lastTimeFront, 0.0f, 1.0f), desiredVelocity.y, 0.0f);
+
+ //Execute movement
+ if (this->hasLocalController())
+ {
+ float dist_y = velocity.y * dt;
+ float dist_x = velocity.x * dt;
+ if(dist_y + posforeward > -42*3 && dist_y + posforeward < 42*6)
+ posforeward += dist_y;
+ else
+ {
+ velocity.y = 0;
+ // restart if game ended
+ if (getGame())
+ if (getGame()->bEndGame)
+ {
+ getGame()->start();
+ return;
+ }
+ }
+ if (pos.z + dist_x > 42*2.5 || pos.z + dist_x < -42*3)
+ velocity.x = 0;
+ pos += Vector3(1000 + velocity.y, 0, velocity.x) * dt;
+
+ }
+
+ // shoot!
+ if (isFireing)
+ ControllableEntity::fire(0);
+
+ // Camera
+ WeakPtr<Camera> camera = this->getCamera();
+ if (camera != NULL)
+ {
+ camera->setPosition(Vector3(-pos.z, -posforeward, 0));
+ camera->setOrientation(Vector3::UNIT_Z, Degree(90));
+ }
+
+
+
+ // bring back on track!
+ if(pos.y != 0)
+ pos.y = 0;
+
+ setPosition(pos);
+ setOrientation(Vector3::UNIT_Y, Degree(270));
+
+ // Level up!
+ if (pos.x > 42000)
+ {
+ updateLevel();
+ setPosition(Vector3(0, 0, pos.z)); // pos - Vector3(30000, 0, 0)
+ }
+ */
+
+ if (left == true)
+ {
+ pos += Vector3(100 + pos.y, 0, 0) * dt;
+ left = false;
+ }
+ else if (right == true)
+ {
+ right = false;
+ }
+
+ setPosition(pos);
+
+
+ SUPER(JumpShip, tick, dt);
+ }
+/*
+ void JumpShip::updateLevel()
+ {
+ lastTime = 0;
+ if (getGame())
+ getGame()->levelUp();
+ }*/
+
+ void JumpShip::moveFrontBack(const Vector2& value)
+ {
+ //lastTimeLeft = 0;
+ //desiredVelocity.x = -value.x * speed;
+ }
+
+ void JumpShip::moveRightLeft(const Vector2& value)
+ {
+ if (value.y < 0)
+ {
+ left = true;
+ }
+ else if (value.y > 0)
+ {
+ right = true;
+ }
+ //lastTimeFront = 0;
+ //desiredVelocity.y = value.y * speed * 42;
+ }
+
+ /*
+ void JumpShip::boost(bool bBoost)
+ {
+ isFireing = bBoost;
+ }
+ inline bool JumpShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
+ {
+ // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint;
+ WeakPtr<JumpEnemy> enemy = orxonox_cast<JumpEnemy*>(otherObject);
+ WeakPtr<Projectile> shot = orxonox_cast<Projectile*>(otherObject);
+ // ensure that this gets only called once per enemy.
+ if (enemy != NULL && lastEnemy != enemy)
+ {
+ lastEnemy = enemy;
+
+ removeHealth(20);
+ if (getGame())
+ {
+ getGame()->multiplier = 1;
+ }
+ }
+ // was shot, decrease multiplier
+ else if (shot != NULL && lastShot != shot)
+ {
+ if (getGame() && orxonox_cast<JumpEnemy*>(shot->getShooter()) != NULL)
+ {
+ if (getGame()->multiplier > 1)
+ {
+ lastShot = shot;
+ getGame()->multiplier -= 1;
+ }
+ }
+ }
+ return false;
+ // SUPER(JumpShip, collidesAgainst, otherObject, contactPoint);
+ }
+
+ void JumpShip::death()
+ {
+ getGame()->costLife();
+ SpaceShip::death();
+ }
+*/
+ WeakPtr<Jump> JumpShip::getGame()
+ {
+ if (game == NULL)
+ {
+ for (ObjectList<Jump>::iterator it = ObjectList<Jump>::begin(); it != ObjectList<Jump>::end(); ++it)
+ {
+ game = *it;
+ }
+ }
+ return game;
+ }
+
+}
Added: code/branches/pickupsFS14/src/modules/jump/JumpShip.h
===================================================================
--- code/branches/pickupsFS14/src/modules/jump/JumpShip.h (rev 0)
+++ code/branches/pickupsFS14/src/modules/jump/JumpShip.h 2014-03-27 13:10:12 UTC (rev 10005)
@@ -0,0 +1,100 @@
+/*
+ * 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
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file JumpShip.h
+ @brief Declaration of the JumpShip class.
+*/
+
+#ifndef _JumpShip_H__
+#define _JumpShip_H__
+
+#include "jump/JumpPrereqs.h"
+
+#include "worldentities/pawns/SpaceShip.h"
+#include "graphics/Camera.h"
+#include "weapons/projectiles/Projectile.h"
+
+namespace orxonox
+{
+ class _JumpExport JumpShip : public SpaceShip
+ {
+ public:
+ JumpShip(Context* context);
+
+ virtual void tick(float dt);
+
+ // overwrite for 2d movement
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+/*
+ // Starts or stops fireing
+ virtual void boost(bool bBoost);
+
+ //no rotation!
+ virtual void rotateYaw(const Vector2& value){};
+ virtual void rotatePitch(const Vector2& value){};
+ //return to main menu if game has ended.
+ virtual void rotateRoll(const Vector2& value){if (getGame()) if (getGame()->bEndGame) getGame()->end();};
+
+ virtual void updateLevel();
+
+ virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
+
+ protected:
+ virtual void death();*/
+ private:
+ WeakPtr<Jump> getGame();
+ WeakPtr<Jump> game;
+ //Camera* camera;
+ //bool isFireing;
+ //float speed;
+ //float damping
+ //float posforeward;
+ //float lastTimeFront;
+ //float lastTimeLeft;
+ //float lastTime;
+ //WeakPtr<JumpEnemy> lastEnemy;
+ //WeakPtr<Projectile> lastShot;
+
+ /*
+ struct Velocity
+ {
+ float x;
+ float y;
+ } velocity, desiredVelocity;*/
+
+ bool left;
+ bool right;
+
+
+
+ };
+}
+
+#endif /* _JumpShip_H__ */
More information about the Orxonox-commit
mailing list