[Orxonox-commit 7359] r11976 - in code/branches/3DPacman_FS18: data/levels data/overlays src/modules/pacman

dreherm at orxonox.net dreherm at orxonox.net
Thu May 17 16:14:36 CEST 2018


Author: dreherm
Date: 2018-05-17 16:14:35 +0200 (Thu, 17 May 2018)
New Revision: 11976

Modified:
   code/branches/3DPacman_FS18/data/levels/3DPacman.oxw
   code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo
   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/PacmanHUDinfo.cc
   code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
   code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
Log:
HUD erweitert

Modified: code/branches/3DPacman_FS18/data/levels/3DPacman.oxw
===================================================================
--- code/branches/3DPacman_FS18/data/levels/3DPacman.oxw	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/data/levels/3DPacman.oxw	2018-05-17 14:14:35 UTC (rev 11976)
@@ -1769,48 +1769,48 @@
     <collisionShapes> 
 
   <!-- Edge -->  
-  <BoxCollisionShape position="250,30,0" halfExtents="15,15,250" />
-  <BoxCollisionShape position="-250,30,0" halfExtents="15,15,250" />
-  <BoxCollisionShape position="0,30,250" halfExtents="250,15,15" />
-  <BoxCollisionShape position="0,30,-250" halfExtents="250,15,15" />
+  <BoxCollisionShape position="250,10,0" halfExtents="15,15,250" />
+  <BoxCollisionShape position="-250,10,0" halfExtents="15,15,250" />
+  <BoxCollisionShape position="0,10,250" halfExtents="250,15,15" />
+  <BoxCollisionShape position="0,10,-250" halfExtents="250,15,15" />
 
    <!-- Shapes in order -->    
-  <BoxCollisionShape position="-200,30,-65" halfExtents="55,15,35" />
-  <BoxCollisionShape position="-200,30,30" halfExtents="55,15,35" />
-  <BoxCollisionShape position="200,30,-65" halfExtents="55,15,35" />
-  <BoxCollisionShape position="200,30,30" halfExtents="55,15,35" />
-  <BoxCollisionShape position="-175,30,-195" halfExtents="30,15,20" /> <!-- 5 -->  
-  <BoxCollisionShape position="-80,30,-195" halfExtents="40,15,20" />
-  <BoxCollisionShape position="-175,30,-140" halfExtents="30,15,10" />
-  <BoxCollisionShape position="0,30,-210" halfExtents="10,15,30" />
-  <BoxCollisionShape position="80,30,-195" halfExtents="40,15,20" />
-  <BoxCollisionShape position="175,30,-195" halfExtents="30,15,20" /> <!-- 10 -->
-  <BoxCollisionShape position="175,30,-140" halfExtents="30,15,10" />
-  <BoxCollisionShape position="0,30,-140" halfExtents="60,15,10" />
-  <BoxCollisionShape position="0,30,-110" halfExtents="10,15,25" />
-  <BoxCollisionShape position="-100,30,-90" halfExtents="10,15,60" />
-  <BoxCollisionShape position="-70,30,-90" halfExtents="25,15,10" /> <!-- 15 -->
-  <BoxCollisionShape position="100,30,-90" halfExtents="10,15,60" />
-  <BoxCollisionShape position="70,30,-90" halfExtents="25,15,10" />
-  <BoxCollisionShape position="0,30,-20" halfExtents="60,15,35" />
-  <BoxCollisionShape position="-100,30,30" halfExtents="10,15,35" />
-  <BoxCollisionShape position="0,30,50" halfExtents="60,15,10" /> <!-- 20 -->
-  <BoxCollisionShape position="0,30,80" halfExtents="10,15,25" />
-  <BoxCollisionShape position="100,30,30" halfExtents="10,15,35" />
-  <BoxCollisionShape position="-175,30,100" halfExtents="30,15,10" />
-  <BoxCollisionShape position="-155,30,130" halfExtents="10,15,25" />
-  <BoxCollisionShape position="-75,30,100" halfExtents="35,15,10" /> <!-- 25 -->
-  <BoxCollisionShape position="75,30,100" halfExtents="35,15,10" />
-  <BoxCollisionShape position="175,30,100" halfExtents="30,15,10" />
-  <BoxCollisionShape position="155,30,130" halfExtents="10,15,25" />
-  <BoxCollisionShape position="-220,30,150" halfExtents="20,15,10" />
-  <BoxCollisionShape position="-220,30,150" halfExtents="20,15,10" /> <!-- 30 -->
-  <BoxCollisionShape position="0,30,150" halfExtents="60,15,10" />
-  <BoxCollisionShape position="0,30,180" halfExtents="10,15,25" />
-  <BoxCollisionShape position="-100,30,170" halfExtents="10,15,25" />
-  <BoxCollisionShape position="-125,30,200" halfExtents="80,15,10" />
-  <BoxCollisionShape position="100,30,170" halfExtents="10,15,25" /> <!-- 35 -->
-  <BoxCollisionShape position="125,30,200" halfExtents="80,15,10" />
+  <BoxCollisionShape position="-200,10,-65" halfExtents="55,30,35" />
+  <BoxCollisionShape position="-200,10,30" halfExtents="55,30,35" />
+  <BoxCollisionShape position="200,10,-65" halfExtents="55,30,35" />
+  <BoxCollisionShape position="200,10,30" halfExtents="55,30,35" />
+  <BoxCollisionShape position="-175,10,-195" halfExtents="30,30,20" /> <!-- 5 -->  
+  <BoxCollisionShape position="-80,10,-195" halfExtents="40,30,20" />
+  <BoxCollisionShape position="-175,10,-140" halfExtents="30,30,10" />
+  <BoxCollisionShape position="0,10,-210" halfExtents="10,30,30" />
+  <BoxCollisionShape position="80,10,-195" halfExtents="40,30,20" />
+  <BoxCollisionShape position="175,10,-195" halfExtents="30,30,20" /> <!-- 10 -->
+  <BoxCollisionShape position="175,10,-140" halfExtents="30,30,10" />
+  <BoxCollisionShape position="0,10,-140" halfExtents="60,30,10" />
+  <BoxCollisionShape position="0,10,-110" halfExtents="10,30,25" />
+  <BoxCollisionShape position="-100,10,-90" halfExtents="10,30,60" />
+  <BoxCollisionShape position="-70,10,-90" halfExtents="25,30,10" /> <!-- 15 -->
+  <BoxCollisionShape position="100,10,-90" halfExtents="10,30,60" />
+  <BoxCollisionShape position="70,10,-90" halfExtents="25,30,10" />
+  <BoxCollisionShape position="0,10,-20" halfExtents="60,30,35" />
+  <BoxCollisionShape position="-100,10,30" halfExtents="10,30,35" />
+  <BoxCollisionShape position="0,10,50" halfExtents="60,30,10" /> <!-- 20 -->
+  <BoxCollisionShape position="0,10,80" halfExtents="10,30,25" />
+  <BoxCollisionShape position="100,10,30" halfExtents="10,30,35" />
+  <BoxCollisionShape position="-175,10,100" halfExtents="30,30,10" />
+  <BoxCollisionShape position="-155,10,130" halfExtents="10,30,25" />
+  <BoxCollisionShape position="-75,10,100" halfExtents="35,30,10" /> <!-- 25 -->
+  <BoxCollisionShape position="75,10,100" halfExtents="35,30,10" />
+  <BoxCollisionShape position="175,10,100" halfExtents="30,30,10" />
+  <BoxCollisionShape position="155,10,130" halfExtents="10,30,25" />
+  <BoxCollisionShape position="-220,10,150" halfExtents="20,30,10" />
+  <BoxCollisionShape position="-220,10,150" halfExtents="20,30,10" /> <!-- 30 -->
+  <BoxCollisionShape position="0,10,150" halfExtents="60,30,10" />
+  <BoxCollisionShape position="0,10,180" halfExtents="10,30,25" />
+  <BoxCollisionShape position="-100,10,170" halfExtents="10,30,25" />
+  <BoxCollisionShape position="-125,10,200" halfExtents="80,30,10" />
+  <BoxCollisionShape position="100,10,170" halfExtents="10,30,25" /> <!-- 35 -->
+  <BoxCollisionShape position="125,10,200" halfExtents="80,30,10" />
 
 
     </collisionShapes> 

Modified: code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo
===================================================================
--- code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo	2018-05-17 14:14:35 UTC (rev 11976)
@@ -24,6 +24,16 @@
     />
 
     <PacmanHUDinfo
+     position  = "1.4, 2.5"
+     pickpoint = "0.0, 0.0"
+     font      = "ShareTechMono"
+     textsize  = 0.04
+     colour    = "1.0, 1.0, 1.0, 1.0"
+     align     = "right"
+
+    />
+
+    <PacmanHUDinfo
      position  = "0.4, 0.1"
      pickpoint = "0.0, 0.0"
      font      = "ShareTechMono"
@@ -31,7 +41,7 @@
      colour    = "1.0, 1.0, 1.0, 1.0"
      align     = "right"
 
-     showghoststatus     = true
+     showghoststatus   = true
     />
 
  </OverlayGroup>

Modified: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc	2018-05-17 14:14:35 UTC (rev 11976)
@@ -44,7 +44,7 @@
         RegisterObject(Pacman);
 
        // firstGame = true;                   //needed for the HUD
-        lives = 3;
+        lives = 0;
         point = 0;
         level = 1;
 
@@ -76,18 +76,20 @@
     {
         SUPER(Pacman, tick, dt);
 
-        //orxout() << timer << endl;
-        //orxout() << afraid << endl;
-        //orxout() << totallevelpoint << endl;
+        if(deathtime != 0){
+            dead(dt);
+        }
 
+        else{
 
         if(afraid){
-            timer = timer - dt;
+        timer = timer - dt;
             if(timer<=0){
                 setNormal();
             }
         }
 
+
         int i = 0;
         for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
             ghosts[i] = nextghost;
@@ -108,7 +110,7 @@
         }
 
         if(bcolli){
-          this->catched();
+          this->catched(dt);
         }
 
         i = 0;
@@ -124,6 +126,11 @@
             }
         }
 
+        }
+
+
+        
+
     }
 
 
@@ -133,10 +140,13 @@
         return false;
     }
 
-    void Pacman::catched(){
+    void Pacman::catched(float dt){
 
     if(!afraid) {
-        if(!lives) this->end();
+        if(!lives){
+          deathtime = 5;
+          this->dead(dt);  
+        }
         --lives;
         this->posreset();
         }
@@ -224,7 +234,19 @@
 
     }
 
+    bool Pacman::isdead(){
+        return death;
+    }
 
+    void Pacman::dead(float dt){
+        death = true;
+
+        deathtime = deathtime-dt;
+
+        if(deathtime<0)
+            this->end();
+    }
+
     void Pacman::end()
     {
 

Modified: code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h	2018-05-17 14:14:35 UTC (rev 11976)
@@ -74,7 +74,7 @@
 
             void levelUp();
             bool collis(Vector3 one, Vector3 other);
-            void catched();
+            void catched(float dt);
             void posreset();
             void takePoint(PacmanPointSphere* taken);
             PacmanGelb* getPlayer();
@@ -81,6 +81,8 @@
             int getPoints();
             void setAfraid();
             void setNormal();
+            bool isdead();
+            void dead(float dt);
 
 
             bool bEndGame;
@@ -99,6 +101,8 @@
             int totallevelpoint;
             //bool firstGame;
             bool afraid = false;
+            bool death = false;
+            float deathtime = 0;
             
        private:
 

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc	2018-05-17 14:14:35 UTC (rev 11976)
@@ -438,8 +438,22 @@
 
 
     void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
-        if(!dontmove)
+        if(!dontmove){
             this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));
+            
+
+            if(abs(velocity.x) == 2){
+                this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));
+            }
+            else if(velocity.z == 2){
+                this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));
+            }
+            else if(velocity.z == -2){
+                this->setOrientation(Quaternion(Radian(180), Vector3(0, 1, 0)));
+            }
+            else{}
+
+     }
     }
 
     bool PacmanGhost::findpos(Vector3 one, Vector3 other){

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc	2018-05-17 14:14:35 UTC (rev 11976)
@@ -67,18 +67,27 @@
 
         if (this->PacmanGame)
         {
-                if(this->bShowPoints_){
+            bool death = this->PacmanGame->isdead();
+            if(death){
+                bShowPoints_ = false;
+                bShowGhoststatus_ = false;
+                const std::string& deathmessage = "Game Over";
+                    setTextSize(0.4);
+                    this->setCaption(deathmessage);
+            }
+            
+            if(this->bShowPoints_ && !death) {
                     const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->totallevelpoint);
                     setTextSize(0.04);
                     this->setCaption(points);
-                }
-                if(this->bShowGhoststatus_){
+            }
+  
+            if(this->bShowGhoststatus_ && !death){
                     const std::string& ghoststatus = "Do not get caught!";
-                    //if(this->PacmanGame->afraid) const std::string& ghoststatus = "Catch the ghosts!";
-                    orxout() << "Test Hier" << endl;
+                    if(this->PacmanGame->afraid) const std::string& ghoststatus = "Catch the ghosts!";
                     setTextSize(0.04);
                     this->setCaption(ghoststatus);
-                }
+            }
         }
     }    
 

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h	2018-05-17 14:14:35 UTC (rev 11976)
@@ -62,7 +62,7 @@
             inline int getMessageID() const
                 { return messageID; }
 
-            inline void setGhoststatus(int value){
+            inline void setGhoststatus(bool value){
                 this->bShowGhoststatus_ = value;
             }
             inline int getGhoststatus() const

Modified: code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
===================================================================
--- code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc	2018-05-17 14:10:30 UTC (rev 11975)
+++ code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc	2018-05-17 14:14:35 UTC (rev 11976)
@@ -74,7 +74,7 @@
     bool PacmanPointAfraid::taken(Vector3 playerpos)
     { 
         resetposition = this->getPosition();
-      if((abs(resetposition.x - playerpos.x)<1) && (abs(resetposition.z - playerpos.z)<1)){
+      if((abs(resetposition.x - playerpos.x)<5) && (abs(resetposition.z - playerpos.z)<5)){
         this->setPosition(Vector3(resetposition.x, -50, resetposition.z));
         return true;
       } 



More information about the Orxonox-commit mailing list