Index: /code/branches/3DPacman_FS18/data/levels/templates/PacmanGelb.oxt
===================================================================
--- /code/branches/3DPacman_FS18/data/levels/templates/PacmanGelb.oxt	(revision 11899)
+++ /code/branches/3DPacman_FS18/data/levels/templates/PacmanGelb.oxt	(revision 11900)
@@ -35,5 +35,5 @@
    collisionType     = "dynamic"
    mass              = 80
-   linearDamping     = 0.7
+   linearDamping     = 0.9
    angularDamping    = 0.9999999
   >
Index: /code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
===================================================================
--- /code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc	(revision 11899)
+++ /code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc	(revision 11900)
@@ -81,5 +81,6 @@
 
     
-    Vector3 possibleposition[] = {Vector3(0,10,245),Vector3(215,10,245),Vector3(215,10,210)};
+    Vector3 possibleposition[] = {Vector3(175,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195),
+        Vector3(185,10,150),Vector3(135,10,145),Vector3(215,10,150)};
 
     /**
@@ -105,9 +106,9 @@
         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));
+                velocity = Vector3(0,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));
+                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
                 move(dt, actuelposition, velocity);
             }
@@ -116,5 +117,5 @@
         //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)){
+            if(findpos(actuelposition,possibleposition[0])){
                 decision = rand()%1;
             switch(decision){
@@ -123,8 +124,9 @@
                     this->target_z = possibleposition[1].z; 
                     this->ismoving = true;
+                    break;
             }
             
             }
-            else if((abs(actuelposition.x - possibleposition[1].x)<0.1) && (abs(actuelposition.z - possibleposition[1].z)<0.1)){
+            else if(findpos(actuelposition,possibleposition[1])){
                 decision = rand()%2;
             switch(decision){
@@ -137,10 +139,11 @@
                     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;
+                    this->ismoving = true;
+                    break;    
+            }
+
+            }
+            else if(findpos(actuelposition,possibleposition[2])){
+                decision = rand()%2;
             switch(decision){
                 case 0:
@@ -148,7 +151,89 @@
                     this->target_z = possibleposition[1].z; 
                     this->ismoving = true;
+                    break;
+                case 1:
+                    this->target_x = possibleposition[3].x;
+                    this->target_z = possibleposition[3].z; 
+                    this->ismoving = true;
+                    break;
             }
             
             }
+
+            else if(findpos(actuelposition,possibleposition[3])){
+                decision = rand()%3;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[2].x;
+                    this->target_z = possibleposition[2].z; 
+                    this->ismoving = true;
+                    break;
+                case 1:
+                    this->target_x = possibleposition[4].x;
+                    this->target_z = possibleposition[4].z; 
+                    this->ismoving = true;
+                    break;
+                case 2:
+                    this->target_x = possibleposition[5].x;
+                    this->target_z = possibleposition[5].z; 
+                    this->ismoving = true;
+                    break;        
+            }
+            }
+
+            else if(findpos(actuelposition,possibleposition[4])){
+                decision = rand()%2;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[3].x;
+                    this->target_z = possibleposition[3].z; 
+                    this->ismoving = true;
+                    break;
+                case 1:
+                    this->target_x = possibleposition[6].x;
+                    this->target_z = possibleposition[6].z; 
+                    this->ismoving = true;
+                    break;
+            }
+            }
+
+            else if(findpos(actuelposition,possibleposition[5])){
+                decision = rand()%2;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[3].x;
+                    this->target_z = possibleposition[3].z; 
+                    this->ismoving = true;
+                    break;
+                case 1:
+                    this->target_x = possibleposition[7].x;
+                    this->target_z = possibleposition[7].z; 
+                    this->ismoving = true;
+                    break;
+            }
+            }
+
+            else if(findpos(actuelposition,possibleposition[6])){
+                decision = rand()%1;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[4].x;
+                    this->target_z = possibleposition[4].z; 
+                    this->ismoving = true;
+                    break;
+            }
+            }
+
+            else if(findpos(actuelposition,possibleposition[7])){
+                decision = rand()%1;
+            switch(decision){
+                case 0:
+                    this->target_x = possibleposition[5].x;
+                    this->target_z = possibleposition[5].z; 
+                    this->ismoving = true;
+                    break;
+            }
+            }
+
 
             else{
@@ -163,4 +248,9 @@
     }
 
+    bool PacmanGhost::findpos(Vector3 one, Vector3 other){
+        if((abs(one.x - other.x)<0.1) && (abs(one.z - other.z)<0.1)) return true;
+        return false;
+    }
+
     void PacmanGhost::resetGhost(){
         this->setPosition(resetposition);
Index: /code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
===================================================================
--- /code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h	(revision 11899)
+++ /code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h	(revision 11900)
@@ -51,4 +51,6 @@
             void resetGhost();
 
+            bool findpos(Vector3 one, Vector3 other);
+
             inline void setResetPosition(Vector3 rpos)
                 { this->resetposition = rpos; }    
