[Orxonox-commit 7659] r12252 - in code/branches/3DPacman_FS19: data/levels src/modules/pacman

rueegseb at orxonox.net rueegseb at orxonox.net
Thu Mar 28 15:09:12 CET 2019


Author: rueegseb
Date: 2019-03-28 15:09:12 +0100 (Thu, 28 Mar 2019)
New Revision: 12252

Modified:
   code/branches/3DPacman_FS19/data/levels/3DPacman.oxw
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
Log:
Added a feature to differentiate the seperate ghosts

Modified: code/branches/3DPacman_FS19/data/levels/3DPacman.oxw
===================================================================
--- code/branches/3DPacman_FS19/data/levels/3DPacman.oxw	2019-03-28 13:48:40 UTC (rev 12251)
+++ code/branches/3DPacman_FS19/data/levels/3DPacman.oxw	2019-03-28 14:09:12 UTC (rev 12252)
@@ -34,25 +34,25 @@
     <SpawnPoint team=0 position="0,10,150" lookat="0,0,0" spawnclass=PacmanGelb pawndesign=PacmanGelb />
 
 <!-- GHOSTS -->
-<PacmanGhost position="0,10,15" >
+<PacmanGhost position="0,10,15" colour='1'>
     <attached>
         <Model position="0,0,0" mesh="PacmanGhostRed.mesh" scale="5" />
     </attached>
 </PacmanGhost>
 
-<PacmanGhost position="0,10,15" >
+<PacmanGhost position="0,10,15" colour='2'>
     <attached>
         <Model position="0,0,0" mesh="PacmanGhostBlue.mesh" scale="5" />
     </attached>
 </PacmanGhost>
 
-<PacmanGhost position="0,10,15" >
+<PacmanGhost position="0,10,15" colour='3'>
     <attached>
         <Model position="0,0,0" mesh="PacmanGhostOrange.mesh" scale="5" />
     </attached>
 </PacmanGhost>
 
-<PacmanGhost position="0,10,15" >
+<PacmanGhost position="0,10,15" colour='4'>
     <attached>
         <Model position="0,0,0" mesh="PacmanGhostPink.mesh" scale="5" />
     </attached>

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-03-28 13:48:40 UTC (rev 12251)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-03-28 14:09:12 UTC (rev 12252)
@@ -46,7 +46,7 @@
         RegisterObject(PacmanGhost);
 
         this->velocity = Vector3(0, 0, 0);
-
+        this->colour = 1;
         this->setCollisionType(CollisionType::Dynamic);
         
         this->actuelposition = this->getPosition();
@@ -75,6 +75,9 @@
     void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(PacmanGhost, XMLPort, xmlelement, mode);
+
+        XMLPortParam(PacmanGhost, "colour", setColour, getColour, xmlelement, mode);
+
     }
 
 

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	2019-03-28 13:48:40 UTC (rev 12251)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	2019-03-28 14:09:12 UTC (rev 12252)
@@ -57,6 +57,13 @@
             void changemovability();
             bool dontmove = false;
 
+            //analog AutonomousDrone.h
+            inline void setColour( int newColour )
+                { this->coulour = newColour; }
+
+            inline int getColour()
+                { return this->coulour;}
+
         private:
             int decision = 0; 
             Vector3 resetposition = Vector3(0,10,15);
@@ -68,7 +75,14 @@
             int target_x = 0; 
             int target_z = 0;
             bool lockmove = false;
-
+            int colour=0;
+            /*
+            colour=
+            1: red
+            2: blue
+            3: orange
+            4: pink
+            */
             void setnewTarget(int firstdec);
             void setnewTarget(int firstdec, int seconddec);
             void setnewTarget(int firstdec, int seconddec, int thirddec);



More information about the Orxonox-commit mailing list