[Orxonox-commit 7281] r11898 - in code/branches/3DPacman_FS18: data/levels data/levels/templates src/modules src/modules/pacman
dreherm at orxonox.net
dreherm at orxonox.net
Mon Apr 23 13:10:23 CEST 2018
Author: dreherm
Date: 2018-04-23 13:10:23 +0200 (Mon, 23 Apr 2018)
New Revision: 11898
Added:
code/branches/3DPacman_FS18/src/modules/pacman/
code/branches/3DPacman_FS18/src/modules/pacman/CMakeLists.txt
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h
Modified:
code/branches/3DPacman_FS18/data/levels/3DPacman.oxw
code/branches/3DPacman_FS18/data/levels/templates/PacmanGelb.oxt
code/branches/3DPacman_FS18/src/modules/CMakeLists.txt
Log:
Improved player
Modified: code/branches/3DPacman_FS18/data/levels/3DPacman.oxw
===================================================================
--- code/branches/3DPacman_FS18/data/levels/3DPacman.oxw 2018-04-20 10:47:25 UTC (rev 11897)
+++ code/branches/3DPacman_FS18/data/levels/3DPacman.oxw 2018-04-23 11:10:23 UTC (rev 11898)
@@ -16,6 +16,7 @@
?>
<Level>
+
<templates>
<Template link=lodtemplate_default />
</templates>
@@ -29,26 +30,25 @@
<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 team=0 position="0,10,245" lookat="0,0,0" spawnclass=PacmanGelb pawndesign=PacmanGelb />
-
-<PacmanGhost position="215,10,220" resetposition="215,10,220">
+<PacmanGhost position="215,10,245" resetposition="215,10,220">
<attached>
<Model position="0,0,0" mesh="PacmanGhostRed.mesh" scale="5" />
</attached>
</PacmanGhost>
-<PacmanGhost position="215,10,220" resetposition="215,10,220">
+<PacmanGhost position="215,10,245" resetposition="215,10,220">
<attached>
<Model position="0,0,0" mesh="PacmanGhostBlue.mesh" scale="5" />
</attached>
</PacmanGhost>
-<PacmanGhost position="215,10,220" resetposition="215,10,220">
+<PacmanGhost position="215,10,245" resetposition="215,10,220">
<attached>
<Model position="0,0,0" mesh="PacmanGhostOrange.mesh" scale="5" />
</attached>
</PacmanGhost>
-<PacmanGhost position="215,10,220" resetposition="215,10,220">
+<PacmanGhost position="215,10,245" resetposition="215,10,220">
<attached>
<Model position="0,0,0" mesh="PacmanGhostPink.mesh" scale="5" />
</attached>
Modified: code/branches/3DPacman_FS18/data/levels/templates/PacmanGelb.oxt
===================================================================
--- code/branches/3DPacman_FS18/data/levels/templates/PacmanGelb.oxt 2018-04-20 10:47:25 UTC (rev 11897)
+++ code/branches/3DPacman_FS18/data/levels/templates/PacmanGelb.oxt 2018-04-23 11:10:23 UTC (rev 11898)
@@ -54,18 +54,7 @@
<BoxCollisionShape position="-12.6,-2, 3" halfExtents="2.8,2.8,11"/>
<BoxCollisionShape position="0, 0,-12" halfExtents="4 , 4 ,7" />
</collisionShapes>
- <explosion>
- <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" />
- <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" />
- <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" />
- <ExplosionPart mesh="explosionparts/escort_part_1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
- <ExplosionPart mesh="explosionparts/escort_part_2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
- <ExplosionPart mesh="explosionparts/escort_part_3.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
- <ExplosionPart mesh="explosionparts/escort_part_4.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
- <ExplosionPart mesh="explosionparts/escort_part_5.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
- <ExplosionPart mesh="explosionparts/escort_part_6.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
- </explosion>
<?lua
include("../includes/weaponSettingsEscort.oxi")
?>
@@ -84,19 +73,19 @@
<MultiStateEngine
boostfactor = 1.0
- speedfront = 100
- speedback = 70
- speedleftright = 5
- speedupdown = 70
+ speedfront = 50
+ speedback = 20
+ speedleftright = 1
+ speedupdown = 1
defEngineSndNormal = "sounds/Engine_low.ogg"
defEngineSndBoost = "sounds/Engine_high.ogg"
- accelerationfront = 50
- accelerationbrake = 50
- accelerationback = 50
+ accelerationfront = 500
+ accelerationbrake = 5
+ accelerationback = 500
accelerationleftright = 5
- accelerationupdown = 50
+ accelerationupdown = 5
>
<EffectContainer condition="idle">
<WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/>
Modified: code/branches/3DPacman_FS18/src/modules/CMakeLists.txt
===================================================================
--- code/branches/3DPacman_FS18/src/modules/CMakeLists.txt 2018-04-20 10:47:25 UTC (rev 11897)
+++ code/branches/3DPacman_FS18/src/modules/CMakeLists.txt 2018-04-23 11:10:23 UTC (rev 11898)
@@ -48,4 +48,4 @@
ADD_SUBDIRECTORY(superorxobros)
ADD_SUBDIRECTORY(asteroids2D)
ADD_SUBDIRECTORY(flappyorx)
-ADD_SUBDIRECTORY(Pacman)
+ADD_SUBDIRECTORY(pacman)
Added: code/branches/3DPacman_FS18/src/modules/pacman/CMakeLists.txt
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/CMakeLists.txt (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/CMakeLists.txt 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,21 @@
+SET_SOURCE_FILES(PICKUP_SRC_FILES
+
+ Pacman.cc
+ PacmanGhost.cc
+ PacmanGelb.cc
+ PacmanPointSphere.cc
+)
+
+ORXONOX_ADD_LIBRARY(Pacman
+ MODULE
+ FIND_HEADER_FILES
+ TOLUA_FILES
+
+ PCH_FILE
+
+ LINK_LIBRARIES
+ orxonox
+ objects
+ pickup
+ SOURCE_FILES ${PICKUP_SRC_FILES}
+)
Added: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,168 @@
+/*
+ * 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 3DPacman.cc
+ @brief Implementation of the 3DPacman class.
+*/
+
+#include "Pacman.h"
+#include "core/CoreIncludes.h"
+
+
+namespace orxonox
+{
+ RegisterUnloadableClass(Pacman);
+
+ Pacman::Pacman(Context* context) : Deathmatch(context)
+ {
+ RegisterObject(Pacman);
+
+ lives = 3;
+ point = 0;
+ level = 1;
+
+ }
+
+ void Pacman::levelUp()
+ {
+ this->end();
+ }
+
+
+ PacmanGhost* ghosts[4];
+ PacmanPointSphere* spheres[1];
+
+
+ void Pacman::tick(float dt)
+ {
+ int i = 0;
+ for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
+ ghosts[i] = nextghost;
+ i++;
+ }
+
+ player = this->getPlayer();
+ if (player != nullptr)
+ {
+ currentPosition = player->getWorldPosition();
+ }
+
+ bcolli = false;
+ for(int nrghost = 0; (nrghost<3) && (!bcolli); ++nrghost){
+ bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
+ }
+ if(bcolli){
+ this->catched();
+ }
+
+ i = 0;
+ for(PacmanPointSphere* nextsphere : ObjectList<PacmanPointSphere>()){
+ if(collis(nextsphere->getPosition(), currentPosition)){
+ takePoint(nextsphere);
+ }
+ }
+
+ SUPER(Pacman, tick, dt);
+
+ }
+
+
+ bool Pacman::collis(Vector3 one, Vector3 other){
+ if((abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1))
+ return true;
+ return false;
+ }
+
+ void Pacman::catched(){
+ if(!lives) this->end();
+ --lives;
+ this->posreset();
+ }
+
+ void Pacman::posreset(){
+ int i = 0;
+ for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
+ nextghost->resetGhost();
+ i++;
+ }
+ player->setPosition(startposplayer);
+ }
+
+ void Pacman::takePoint(PacmanPointSphere* taken){
+ ++point;
+ if(point == totallevelpoint) this->levelUp();
+
+ Vector3 postaken = taken->getPosition();
+ postaken.y = -50;
+ taken->setPosition(postaken);
+ }
+
+
+ PacmanGelb* Pacman::getPlayer()
+ {
+ for (PacmanGelb* ship : ObjectList<PacmanGelb>())
+ {
+ return ship;
+ }
+ return nullptr;
+ }
+
+ int Pacman::getPoints(){
+ return point;
+ }
+
+
+ void Pacman::start()
+ {
+ orxout() << "start" << endl;
+
+ Deathmatch::start();
+ }
+
+ void Pacman::playerPreSpawn(PlayerInfo* player)
+ {
+ //PlayerInfo* playerInfo_;
+ //this->playerInfo_ = player;
+ if(lives <= 0)
+ {
+ this->end();
+ }
+ }
+
+
+ void Pacman::end()
+ {
+ if (Highscore::exists())
+ {
+ //int score = this->getPoints();
+ //Highscore::getInstance().storeScore("3DPacman", score, this->playerInfo_);
+ }
+ GSLevel::startMainMenu();
+ }
+}
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,137 @@
+/*
+ * 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 DodgeRace.h
+ @brief Gametype.
+ @ingroup DodgeRace
+*/
+
+#ifndef _Pacman_H__
+#define _Pacman_H__
+
+#include "PacmanGelb.h"
+#include "PacmanGhost.h"
+#include "PacmanPointSphere.h"
+#include "Highscore.h"
+//#include "PlayerInfo.h"
+
+
+#include "core/EventIncludes.h"
+#include "core/command/Executor.h"
+#include "core/config/ConfigValueIncludes.h"
+
+#include "gamestates/GSLevel.h"
+#include "chat/ChatManager.h"
+#include <vector>
+
+// ! HACK
+#include "infos/PlayerInfo.h"
+
+#include "core/command/ConsoleCommand.h"
+
+#include "gametypes/Deathmatch.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+
+ class _PacmanExport Pacman : public Deathmatch
+ {
+ public:
+ Pacman(Context* context);
+
+ virtual void start() override;
+ virtual void end() override;
+
+ virtual void tick(float dt) override;
+
+ virtual void playerPreSpawn(PlayerInfo* player) override;
+
+ void levelUp();
+ bool collis(Vector3 one, Vector3 other);
+ void catched();
+ void posreset();
+ void takePoint(PacmanPointSphere* taken);
+ PacmanGelb* getPlayer();
+ int getPoints();
+
+
+ bool bEndGame;
+ bool bShowLevel;
+ int lives;
+ int multiplier;
+ float counter;
+ int pattern;
+ float lastPosition;
+
+ Vector3 currentPosition;
+ PacmanGelb* player;
+ bool bcolli = false;
+ Vector3 startposplayer = Vector3(0,10,245);
+ int totallevelpoint = 1;
+
+ private:
+
+
+ Timer endGameTimer;
+ int level;
+ int point;
+ bool b_combo;
+
+ Timer enemySpawnTimer;
+ Timer comboTimer;
+ Timer showLevelTimer;
+
+
+ /*
+
+ //void spawnEnemy();
+
+
+
+
+
+
+
+
+
+
+
+
+ private:
+
+
+
+
+ //Context* context;
+ */
+ };
+}
+
+#endif /* _DodgeRace_H__ */
\ No newline at end of file
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,55 @@
+/*
+ * 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 DodgeRaceShip.cc
+ @brief Implementation of the DodgeRaceShip class.
+*/
+
+#include "PacmanGelb.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ RegisterClass(PacmanGelb);
+
+ PacmanGelb::PacmanGelb(Context* context) : SpaceShip(context)
+ {
+ RegisterObject(PacmanGelb);
+ }
+
+ void PacmanGelb::tick(float dt)
+ {
+ SUPER(PacmanGelb, tick, dt);
+ //bring player back to ground
+ actuelposition = this->getPosition();
+ actuelposition.y = 10;
+ this->setPosition(actuelposition);
+ }
+}
+
\ No newline at end of file
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,64 @@
+/*
+ * 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 DodgeRaceShip.h
+ @brief Declaration of the DodgeRaceShip class.
+*/
+
+#ifndef _PacmanGelb_H__
+#define _PacmanGelb_H__
+
+
+#include "pacman/PacmanPrereqs.h"
+
+#include "core/XMLPort.h"
+#include "worldentities/pawns/SpaceShip.h"
+#include "graphics/Camera.h"
+
+namespace orxonox
+{
+ class _PacmanExport PacmanGelb : public SpaceShip
+ {
+ public:
+ PacmanGelb(Context* context);
+
+ virtual void tick(float dt);
+
+ //no rotation
+ //virtual void rotateYaw(const Vector2& value) override{};
+ virtual void rotatePitch(const Vector2& value) override{};
+
+ private:
+ Vector3 actuelposition;
+ Quaternion actuelorient;
+
+ };
+}
+
+#endif
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,168 @@
+/*
+ * 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:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#include "PacmanGhost.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+namespace orxonox
+{
+ RegisterClass(PacmanGhost);
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ @param creator
+ The creator of this object.
+ */
+ PacmanGhost::PacmanGhost(Context* context) : ControllableEntity(context)
+ {
+ RegisterObject(PacmanGhost);
+
+ this->velocity = Vector3(0, 0, 0);
+
+ this->setCollisionType(CollisionType::Dynamic);
+
+ this->resetposition = Vector3(0,20,245); //Set Default start position
+
+ this->actuelposition = this->getPosition();
+
+ this->target_x = actuelposition.x;
+ this->target_z = actuelposition.z;
+
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ PacmanGhost::~PacmanGhost()
+ {
+ // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
+ }
+
+ /**
+ @brief
+ Method for creating a AutonomousDrone through XML.
+ */
+ void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PacmanGhost, XMLPort, xmlelement, mode);
+
+ XMLPortParam(PacmanGhost, "resetposition", setResetPosition, getResetPosition, xmlelement, mode);
+ }
+
+
+
+ Vector3 possibleposition[] = {Vector3(0,10,245),Vector3(215,10,245),Vector3(215,10,210)};
+
+ /**
+ @brief
+ Defines which actions the AutonomousDrone has to take in each tick.
+ @param dt
+ The length of the tick.
+ */
+ void PacmanGhost::tick(float dt)
+ {
+ SUPER(PacmanGhost, tick, dt);
+
+ //setorientation
+
+ this->actuelposition = this->getPosition();
+
+ //Stop, if target arrived
+ if((abs(this->actuelposition.x - this->target_x)<0.1) && (abs(this->actuelposition.z - this->target_z)<0.1)){
+ this->ismoving = false;
+ }
+
+ //Move, if ghost hasn't arrived yet
+ if(this->ismoving){
+ if(!(abs(this->actuelposition.z-target_z)<0.1)) {
+ velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,-sgn(this->actuelposition.z-this->target_z));
+ move(dt, actuelposition, velocity);
+ }
+ if(!(abs(this->actuelposition.x-target_x)<0.1)){
+ velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,-sgn(this->actuelposition.z-this->target_z));
+ move(dt, actuelposition, velocity);
+ }
+ }
+
+ //Check on which position ghost has arrived and set new target
+ else{
+ if((abs(this->actuelposition.x - possibleposition[0].x)<0.1) && (abs(this->actuelposition.z - possibleposition[0].z)<0.1)){
+ decision = rand()%1;
+ switch(decision){
+ case 0:
+ this->target_x = possibleposition[1].x;
+ this->target_z = possibleposition[1].z;
+ this->ismoving = true;
+ }
+
+ }
+ else if((abs(actuelposition.x - possibleposition[1].x)<0.1) && (abs(actuelposition.z - possibleposition[1].z)<0.1)){
+ decision = rand()%2;
+ switch(decision){
+ case 0:
+ this->target_x = possibleposition[0].x;
+ this->target_z = possibleposition[0].z;
+ this->ismoving = true;
+ break;
+ case 1:
+ this->target_x = possibleposition[2].x;
+ this->target_z = possibleposition[2].z;
+ this->ismoving = true;
+ }
+
+ }
+ if((abs(this->actuelposition.x - possibleposition[2].x)<0.1) && (abs(this->actuelposition.z - possibleposition[2].z)<0.1)){
+ decision = rand()%1;
+ switch(decision){
+ case 0:
+ this->target_x = possibleposition[1].x;
+ this->target_z = possibleposition[1].z;
+ this->ismoving = true;
+ }
+
+ }
+
+ else{
+ } //End of Position table
+ }
+
+ }
+
+
+ void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
+ this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));
+ }
+
+ void PacmanGhost::resetGhost(){
+ this->setPosition(resetposition);
+ }
+}
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,73 @@
+/*
+ * 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:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#ifndef _PacmanGhost_H__
+#define _PacmanGhost_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/XMLPort.h"
+
+#include "worldentities/ControllableEntity.h"
+
+namespace orxonox {
+
+ class _OrxonoxExport PacmanGhost : public ControllableEntity
+ {
+ public:
+ PacmanGhost(Context* context);
+ virtual ~PacmanGhost();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
+ virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+ void move(float dt, Vector3 actuelposition, Vector3 velocity);
+
+ void resetGhost();
+
+ inline void setResetPosition(Vector3 rpos)
+ { this->resetposition = rpos; }
+
+ inline Vector3 getResetPosition()
+ { return this->resetposition; }
+
+
+
+ private:
+ bool ismoving = false;
+ int decision = 0; //Gives the random which way information to the ghost.
+ int target_x = 0;
+ int target_z = 0;
+ Vector3 actuelposition;
+ Vector3 velocity;
+ Vector3 resetposition;
+ };
+
+}
+
+#endif
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,90 @@
+/*
+ * 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:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#include "PacmanPointSphere.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+namespace orxonox
+{
+ RegisterClass(PacmanPointSphere);
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ @param creator
+ The creator of this object.
+ */
+ PacmanPointSphere::PacmanPointSphere(Context* context) : ControllableEntity(context)
+ {
+ RegisterObject(PacmanPointSphere);
+ this->setCollisionType(CollisionType::None);
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ PacmanPointSphere::~PacmanPointSphere()
+ {
+ // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
+ }
+
+ /**
+ @brief
+ Method for creating a AutonomousDrone through XML.
+ */
+ void PacmanPointSphere::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(PacmanPointSphere, XMLPort, xmlelement, mode);
+
+ XMLPortParam(PacmanPointSphere, "resetposition", setResetPosition, getResetPosition, xmlelement, mode);
+ }
+
+
+ void PacmanPointSphere::tick(float dt)
+ {
+ SUPER(PacmanPointSphere, tick, dt);
+ }
+
+ bool PacmanPointSphere::taken(Vector3 playerpos)
+ {
+ if((abs(this->resetposition.x - playerpos.x)<0.1) && (abs(this->resetposition.z - playerpos.z)<0.1)){
+ this->setPosition(Vector3(resetposition.x, -50, resetposition.z));
+ return true;
+ }
+
+ return false;
+ }
+
+
+ void PacmanPointSphere::resetPacmanPointSphere(){
+ this->setPosition(resetposition);
+ }
+}
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,65 @@
+/*
+ * 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:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#ifndef _PacmanPointSphere_H__
+#define _PacmanPointSphere_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/XMLPort.h"
+
+#include "worldentities/ControllableEntity.h"
+
+namespace orxonox {
+
+ class _OrxonoxExport PacmanPointSphere : public ControllableEntity
+ {
+ public:
+ PacmanPointSphere(Context* context);
+ virtual ~PacmanPointSphere();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
+ virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+ bool taken(Vector3 playerpos);
+ void resetPacmanPointSphere();
+
+ inline void setResetPosition(Vector3 rpos)
+ { this->resetposition = rpos; }
+
+ inline Vector3 getResetPosition()
+ { return this->resetposition; }
+
+ private:
+
+ Vector3 resetposition;
+ };
+
+}
+
+#endif
Property changes on: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h (rev 0)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h 2018-04-23 11:10:23 UTC (rev 11898)
@@ -0,0 +1,73 @@
+/*
+ * 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 DodgeRace module
+*/
+
+#ifndef _PacmanPrereqs_H__
+#define _PacmanPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(PACMAN_STATIC_BUILD)
+# ifdef PACMAN_SHARED_BUILD
+# define _PacmanExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _PacmanExport
+# else
+# define _PacmanExport __declspec(dllimport)
+# endif
+# endif
+# define _PacmanPrivate
+#elif defined (ORXONOX_GCC_VISIBILITY)
+# define _PacmanExport __attribute__ ((visibility("default")))
+# define _PacmanPrivate __attribute__ ((visibility("hidden")))
+#else
+# define _PacmanExport
+# define _PacmanPrivate
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+
+}
+
+#endif
More information about the Orxonox-commit
mailing list