[Orxonox-commit 7666] r12259 - code/branches/3DPacman_FS19/src/modules/pacman

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


Author: rueegseb
Date: 2019-03-28 15:47:15 +0100 (Thu, 28 Mar 2019)
New Revision: 12259

Modified:
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
Log:
distinguish the different Ghost when the Ghost is not moving

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-03-28 14:43:00 UTC (rev 12258)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-03-28 14:47:15 UTC (rev 12259)
@@ -118,7 +118,7 @@
         if(this->ismoving){
             if(!(abs(this->actuelposition.z-target_z)<0.5)) {
                 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
-                move(dt, actuelposition, velocity);
+                move(dt, actuelposition, newGoal, velocity);
             }    
             if(!(abs(this->actuelposition.x-target_x)<0.5)){
                 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
@@ -125,6 +125,32 @@
                 move(dt, actuelposition, velocity);
             }
         }
+
+        else{
+            while (lockmove){};
+            lockmove=true;
+
+            if(this.colour=1){
+                //calculate new goal
+
+            }
+
+            else if(this.colour=2){
+
+            }
+
+            else if(this.colour=3){
+
+            }
+
+            else if(this.colour=4){
+
+            }
+
+            getShortestPath(actuelposition, goal_x, goal_z)
+            //setnewTarget
+        }
+        /*
         //Check on which position the ghost has arrived and set new target
          else{
             while(lockmove){};
@@ -337,7 +363,7 @@
             } //End of Position table
                 lockmove = false;
             }
-        
+        */
     }
 
     //Random choice of new target (not used in game, but useful)

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	2019-03-28 14:43:00 UTC (rev 12258)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	2019-03-28 14:47:15 UTC (rev 12259)
@@ -72,8 +72,11 @@
 
             Vector3 actuelposition;
             bool ismoving = false;
-            int target_x = 0; 
+            int target_x = 0;   // next step 
             int target_z = 0;
+            int goal_x = 0;     // faraway goal to dertmine the direction of the target
+            int goal_z =0;    
+
             bool lockmove = false;
             int colour=0;
             /*



More information about the Orxonox-commit mailing list