[Orxonox-commit 7375] r11992 - code/branches/3DPacman_FS18/src/modules/pacman

dreherm at orxonox.net dreherm at orxonox.net
Thu May 24 15:36:40 CEST 2018


Author: dreherm
Date: 2018-05-24 15:36:40 +0200 (Thu, 24 May 2018)
New Revision: 11992

Modified:
   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/PacmanGhost.cc
   code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
   code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
   code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
   code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
   code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.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
Log:
Testversion 1

Modified: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc	2018-05-24 13:36:40 UTC (rev 11992)
@@ -247,6 +247,10 @@
     bool Pacman::isdead(){
         return death;
     }
+    //Getter
+    int Pacman::getTotalpoints(){
+        return totallevelpoint;
+    }
 
 
     void Pacman::start()
@@ -271,9 +275,6 @@
     void Pacman::dead(float dt){
         death = true;
 
-        //if (Highscore::exists())
-          //  Highscore::getInstance().storeScore("3DPacman", this->getPoints(), this->playerInfo_);
-
         deathtime = deathtime-dt;
 
         if(deathtime<0)

Modified: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Florian Zinggeler
+ *      Marc Dreher
  *   Co-authors:
  *      ...
  *
@@ -39,8 +39,6 @@
 #include "PacmanGhost.h"
 #include "PacmanPointSphere.h"
 #include "PacmanPointAfraid.h"
-#include "Highscore.h"
-//#include "PlayerInfo.h"
 
 
 #include "core/EventIncludes.h"
@@ -72,77 +70,41 @@
 
             virtual void tick(float dt) override;
 
+            PacmanGelb* getPlayer();
+            int getPoints();
+            bool getAfraid();
+            int getTimer();
+            int getLives();
+            int getLevel();
+            int getTotalpoints();
+            bool isdead();
+            
+       private:
+
             void levelUp();
             bool collis(Vector3 one, Vector3 other);
             void catched(float dt);
             void posreset();
             void takePoint(PacmanPointSphere* taken);
-            PacmanGelb* getPlayer();
-            int getPoints();
             void setAfraid();
             void setNormal();
-            bool isdead();
             void dead(float dt);
-            bool getAfraid();
-            int getTimer();
-            int getLives();
-            int getLevel();
 
-
-            bool bEndGame;
-            bool bShowLevel;
-            int lives;
-            int multiplier;
-            float counter;
-            int pattern;
-            float lastPosition;
-
+            PacmanGelb* player;
             Vector3 currentPosition;
-            PacmanGelb* player;
+            Vector3 startposplayer = Vector3(0,10,150);
             bool bcolli = false;
-            float timer = 0;
-            Vector3 startposplayer = Vector3(0,10,150);
+           
             int totallevelpoint;
-            //bool firstGame;
+            
             bool afraid = false;
             bool death = false;
             float deathtime = 0;
-            
-       private:
+            float timer = 0;
 
-
-            Timer endGameTimer;
             int level;
             int point;
-            bool b_combo;
-
-            Timer enemySpawnTimer;
-            Timer comboTimer;
-            Timer showLevelTimer;
-
-/*
-std::string sDeathMessage;
-const std::vector<std::string> DeathMessage7 = {
-                "You should really try that again",
-                "You can do better, can you?",
-                "Hey, maybe you get a participation award, that's good isn't it?",
-                "Congratulations, you get a medal, a wooden one",
-                "That was flappin bad!",
-                "Well, that was a waste of time",
-                "You suck!",
-                "Maybe try SuperOrxoBros. That game is not as hard.",
-                "Here's a tip: Try not to fly into these grey thingies.",
-                "We won't comment on that."};
-            const std::vector<std::string> DeathMessage20 = {
-                "Getting better!",
-                "Training has paid off, huh?",
-                "Good average!",
-                "That was somehow enjoyable to watch",
-                "Flappin average",
-                "Getting closer to something",
-                "That wasn't crap, not bad",
-                "Surprisingly not bad."};
-  */      
+            int lives;
         
     };
 }

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      Marc Dreher
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      ..
  *
  */
 
@@ -61,7 +61,7 @@
 
     /**
     @brief
-        Destructor. Destroys controller, if present.
+        Destructor. Destroys ghost, if present.
     */
     PacmanGhost::~PacmanGhost()
     {
@@ -70,7 +70,7 @@
 
     /**
     @brief
-        Method for creating a AutonomousDrone through XML.
+        Method for creating a ghost through XML.
     */
     void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
@@ -78,7 +78,7 @@
     }
 
 
-
+    //All positions in the map, see documentation
     Vector3 possibleposition[] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-4
         Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9
         Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14
@@ -96,7 +96,7 @@
 
     /**
     @brief
-        Defines which actions the AutonomousDrone has to take in each tick.
+        Defines which actions the ghost has to take in each tick.
     @param dt
         The length of the tick.
     */
@@ -104,8 +104,6 @@
     {
         SUPER(PacmanGhost, tick, dt);
 
-        //setorientation
-
         this->actuelposition = this->getPosition();
         
         //Stop, if target arrived
@@ -339,6 +337,7 @@
         
     }
 
+    //Random choice of new target (not used in game, but useful)
     void PacmanGhost::setnewTarget(int firstdec){
         
     	  decision = rand()%1;
@@ -351,6 +350,7 @@
     		}
     }
 
+    //Random choice of new target
     void PacmanGhost::setnewTarget(int firstdec, int seconddec){ 
     	   decision = rand()%2;
             switch(decision){
@@ -368,6 +368,7 @@
             
     }
 
+    //Random choice of new target
     void PacmanGhost::setnewTarget(int firstdec, int seconddec, int thirddec){
         
     	   decision = rand()%3;
@@ -391,6 +392,7 @@
             
 	}
 
+    //Random choice of new target
     void PacmanGhost::setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec){
         
     	   decision = rand()%4;
@@ -419,14 +421,15 @@
             
 	}
 
+    //Change this with other ghost
     void PacmanGhost::changewith(PacmanGhost* otherghost){
 
         while(lockmove){};
-        lockmove = true;
+        lockmove = true;    //Prevent change of target while ghost is changed
 
         otherghost->setPosition(this->getPosition());
         this->setPosition(0,-20,0);
-        otherghost->target_x = this->target_x;   //Probleme bei parallelen Porzessen
+        otherghost->target_x = this->target_x;   
         otherghost->target_z = this->target_z;
         otherghost->ismoving = this->ismoving;
 
@@ -436,10 +439,12 @@
         lockmove = false;
     }
 
-
+    //Move ghost with rotation
     void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
         if(!dontmove){
             this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt));
+        
+        //Rotate ghost in the direction of movement 
         if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1))
             if(velocity.x<0){
                  this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0)));  
@@ -454,16 +459,17 @@
             else{
                  this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));  
             }
-            this->getOrientation();
                      
      }
     }
 
+    //Check if there is a collision
     bool PacmanGhost::findpos(Vector3 one, Vector3 other){
        if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true;
         return false;
     }
 
+    //Change ability to move
     void PacmanGhost::changemovability(){
         if(dontmove){
          dontmove = false;}
@@ -472,6 +478,7 @@
         }
     }
 
+    //ResetGhost
     void PacmanGhost::resetGhost(){
     
         this->setPosition(this->resetposition);
@@ -483,6 +490,7 @@
     
     }
 
+    //Increase speed of ghosts
     void PacmanGhost::levelupvelo(){
         speed ++;
     }

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      Marc Dreher
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      ..
  *
  */
 
@@ -34,7 +34,7 @@
 #include "core/XMLPort.h"
 
 #include "worldentities/ControllableEntity.h"
-//Test 
+
 namespace orxonox {
 
     class _OrxonoxExport PacmanGhost : public ControllableEntity
@@ -50,10 +50,6 @@
             
             void resetGhost();
 
-            void setnewTarget(int firstdec);
-            void setnewTarget(int firstdec, int seconddec);
-            void setnewTarget(int firstdec, int seconddec, int thirddec);
-            void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec);
             void changewith(PacmanGhost* otherghost);
             void levelupvelo();
 
@@ -60,19 +56,23 @@
             bool findpos(Vector3 one, Vector3 other);      
             void changemovability();
             bool dontmove = false;
-            bool lockmove = false;
 
+        private:
+            int decision = 0; 
+            Vector3 resetposition = Vector3(0,10,15);
+            Vector3 velocity;
+            int speed = 20;
+
             Vector3 actuelposition;
             bool ismoving = false;
             int target_x = 0; 
             int target_z = 0;
-            Vector3 velocity;
-            Vector3 oldvelocity = Vector3(2,0,0);
-            int speed = 20;
+            bool lockmove = false;
 
-        private:
-            int decision = 0; //Gives the random which way information to the ghost.
-            Vector3 resetposition = Vector3(0,10,15);
+            void setnewTarget(int firstdec);
+            void setnewTarget(int firstdec, int seconddec);
+            void setnewTarget(int firstdec, int seconddec, int thirddec);
+            void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec);
     };
 
 }

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,9 +20,8 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Leo Merholz
- *      Pascal Schärli
- *
+ *      Marc Dreher
+
  *      Co-authors:
  *      ...
  */
@@ -78,7 +77,7 @@
             }
             
             if(this->bShowPoints_) {
-                    const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->totallevelpoint);
+                    const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->getTotalpoints());
                     setTextSize(0.03);
                     this->setCaption(points);
             }

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Florian Zinggeler
+ *      Marc Dreher
  *
  */
 

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      Marc Dreher
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      
  *
  */
 
@@ -58,7 +58,7 @@
 
     /**
     @brief
-        Method for creating a AutonomousDrone through XML.
+        Method for creating a PacmanPointAfraid through XML.
     */
     void PacmanPointAfraid::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
@@ -71,6 +71,7 @@
         SUPER(PacmanPointAfraid, tick, dt);
     }
 
+    //Check for collision
     bool PacmanPointAfraid::taken(Vector3 playerpos)
     { 
         resetposition = this->getPosition();
@@ -82,7 +83,7 @@
       return false;
     }
 
-
+    //Reset position
     void PacmanPointAfraid::resetPacmanPointAfraid(){
         resetposition = this->getPosition();
         resetposition.y = 10;

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.h	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.h	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      Marc Dreher
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *   
  *
  */
 
@@ -43,8 +43,8 @@
             PacmanPointAfraid(Context* context);
             virtual ~PacmanPointAfraid();
 
-            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.
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 
+            virtual void tick(float dt); 
 
             bool taken(Vector3 playerpos);
             void resetPacmanPointAfraid();

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      Marc Dreher
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      
  *
  */
 
@@ -71,6 +71,7 @@
         SUPER(PacmanPointSphere, tick, dt);
     }
 
+    //Check for collision
     bool PacmanPointSphere::taken(Vector3 playerpos)
     {
         resetposition = this->getPosition();
@@ -82,7 +83,7 @@
       return false;
     }
 
-
+    //Reset position
     void PacmanPointSphere::resetPacmanPointSphere(){
         resetposition = this->getPosition();
         resetposition.y = 10;

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      Marc Dreher
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      
  *
  */
 

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h	2018-05-24 13:28:11 UTC (rev 11991)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h	2018-05-24 13:36:40 UTC (rev 11992)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Florian Zinggeler
+ *      Marc Dreher
  *   Co-authors:
  *      ...
  *



More information about the Orxonox-commit mailing list