Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11978


Ignore:
Timestamp:
May 18, 2018, 12:38:37 PM (6 years ago)
Author:
dreherm
Message:

HUd and Ghost rotations

Location:
code/branches/3DPacman_FS18
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo

    r11976 r11978  
    1414
    1515    <PacmanHUDinfo
    16      position  = "0.4, 0.01"
     16     position  = "0.05, 0.05"
    1717     pickpoint = "0.0, 0.0"
    1818     font      = "ShareTechMono"
    1919     textsize  = 0.04
    2020     colour    = "1.0, 1.0, 1.0, 1.0"
    21      align     = "right"
     21     align     = "left"
    2222
    2323     showpoints     = true
     
    2525
    2626    <PacmanHUDinfo
    27      position  = "1.4, 2.5"
     27     position  = "0.45, 0.5"
     28     pickpoint = "0.5, 0.5"
     29     font      = "ShareTechMono"
     30     textsize  = 0.04
     31     colour    = "1.0, 1.0, 1.0, 1.0"
     32     align     = "middle"
     33
     34     showgameover = true
     35
     36    />
     37
     38    <PacmanHUDinfo
     39     position  = "0.05, 0.8"
    2840     pickpoint = "0.0, 0.0"
    2941     font      = "ShareTechMono"
    3042     textsize  = 0.04
    3143     colour    = "1.0, 1.0, 1.0, 1.0"
    32      align     = "right"
     44     align     = "left"
    3345
     46     showghoststatus   = true
    3447    />
    3548
    3649    <PacmanHUDinfo
    37      position  = "0.4, 0.1"
     50     position  = "0.05, 0.9"
    3851     pickpoint = "0.0, 0.0"
    3952     font      = "ShareTechMono"
    4053     textsize  = 0.04
    4154     colour    = "1.0, 1.0, 1.0, 1.0"
    42      align     = "right"
     55     align     = "left"
    4356
    44      showghoststatus   = true
     57     showlive   = true
    4558    />
    4659
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc

    r11976 r11978  
    4444        RegisterObject(Pacman);
    4545
    46        // firstGame = true;                   //needed for the HUD
    47         lives = 0;
     46        lives = 3;
    4847        point = 0;
    4948        level = 1;
    5049
    51        // setHUDTemplate("PacmanOrxHUD");
    52        // scoreboardTemplate_ = "";
    5350    }
    5451
     
    188185    }
    189186
     187    bool Pacman::getAfraid(){
     188        return afraid;
     189    }
     190
     191    int Pacman::getTimer(){
     192        return timer;
     193    }
     194
    190195    void Pacman::posreset(){
    191196        for(int i = 0; i<4; ++i){
     
    215220    int Pacman::getPoints(){
    216221        return point;
     222    }
     223
     224    int Pacman::getLives(){
     225        return lives;
    217226    }
    218227
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h

    r11976 r11978  
    8484            bool isdead();
    8585            void dead(float dt);
     86            bool getAfraid();
     87            int getTimer();
     88            int getLives();
    8689
    8790
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc

    r11898 r11978  
    5151        actuelposition.y = 10;
    5252        this->setPosition(actuelposition);
     53        this->rotatePitch(Vector2(0, 0));
     54
     55       
    5356    }
    5457}
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h

    r11898 r11978  
    4242#include "graphics/Camera.h"
    4343
     44
    4445namespace orxonox
    4546{
     
    5253
    5354            //no rotation
    54             //virtual void rotateYaw(const Vector2& value) override{};
     55            virtual void rotateYaw(const Vector2& value) override{
     56                this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x);
     57
     58                Pawn::rotateYaw(value);
     59
     60                // This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling.
     61                if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_)
     62                this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().y)));
     63            };
    5564            virtual void rotatePitch(const Vector2& value) override{};
    5665
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc

    r11976 r11978  
    441441        if(!dontmove){
    442442            this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));
    443            
    444 
    445             if(abs(velocity.x) == 2){
    446                 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));
    447             }
    448             else if(velocity.z == 2){
    449                 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));
    450             }
    451             else if(velocity.z == -2){
    452                 this->setOrientation(Quaternion(Radian(180), Vector3(0, 1, 0)));
    453             }
    454             else{}
    455 
     443        if((abs(abs(velocity.x)-2)<0.1) && (abs(velocity.z-0)<0.1))
     444            if(velocity.x<0){
     445                 this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0))); 
     446            }
     447            else{
     448                 this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0))); 
     449            }
     450        if((abs(abs(velocity.z)-2)<0.1) && (abs(velocity.x-0)<0.1))
     451            if(velocity.z<0){
     452                 this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0))); 
     453            }
     454            else{
     455                 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); 
     456            }
     457            this->getOrientation();
     458                     
    456459     }
    457460    }
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h

    r11958 r11978  
    6868            int target_z = 0;
    6969            Vector3 velocity;
     70            Vector3 oldvelocity = Vector3(2,0,0);
    7071
    7172        private:
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc

    r11976 r11978  
    5858        XMLPortParam(PacmanHUDinfo, "showghoststatus",   setGhoststatus,   getGhoststatus,   xmlelement, mode).defaultValues(false);
    5959        XMLPortParam(PacmanHUDinfo, "messageID",     setMessageID,     getMessageID,     xmlelement, mode).defaultValues(0);
     60        XMLPortParam(PacmanHUDinfo, "showgameover",   setGameover,   getGameover,   xmlelement, mode).defaultValues(false);
     61        XMLPortParam(PacmanHUDinfo, "showlive",   setlive,   getlive,   xmlelement, mode).defaultValues(false);
    6062       
    6163   
     
    6971        {
    7072            bool death = this->PacmanGame->isdead();
    71             if(death){
    72                 bShowPoints_ = false;
    73                 bShowGhoststatus_ = false;
     73            if(death && showgameover){
    7474                const std::string& deathmessage = "Game Over";
    75                     setTextSize(0.4);
     75                    setTextSize(0.08);
    7676                    this->setCaption(deathmessage);
    7777            }
    7878           
    79             if(this->bShowPoints_ && !death) {
     79            if(this->bShowPoints_) {
    8080                    const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->totallevelpoint);
    81                     setTextSize(0.04);
     81                    setTextSize(0.03);
    8282                    this->setCaption(points);
    8383            }
    8484 
    85             if(this->bShowGhoststatus_ && !death){
    86                     const std::string& ghoststatus = "Do not get caught!";
    87                     if(this->PacmanGame->afraid) const std::string& ghoststatus = "Catch the ghosts!";
    88                     setTextSize(0.04);
    89                     this->setCaption(ghoststatus);
     85            if(this->bShowGhoststatus_){
     86                    if(this->PacmanGame->getAfraid()) {
     87                       const std::string& ghoststatus = "Catch the ghosts! \n " + multi_cast<std::string>(this->PacmanGame->getTimer()) + " seconds left";
     88                       setTextSize(0.03);
     89                       this->setCaption(ghoststatus);
     90                    }
     91                    else{
     92                       const std::string& ghoststatus = "Do not get caught!";
     93                       setTextSize(0.03);
     94                       this->setCaption(ghoststatus);
     95                    }
    9096            }
     97
     98            if(this->showlive){
     99                const std::string& live = "Remaining lives: "+multi_cast<std::string>(this->PacmanGame->getLives());
     100                setTextSize(0.03);
     101                this->setCaption(live);
     102            }
     103
     104            if(death && !(this->showgameover)){
     105                setTextSize(0.0);
     106            }
     107
    91108        }
    92109    }   
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h

    r11976 r11978  
    6969                { return this->bShowGhoststatus_; }
    7070
     71            inline void setGameover(bool value){
     72                this->showgameover = value;
     73            }
     74            inline int getGameover() const
     75                { return this->showgameover; }
     76
     77            inline void setlive(bool value){
     78                this->showlive = value;
     79            }
     80            inline int getlive() const
     81                { return this->showlive; }
     82
     83
    7184        private:
    7285            Pacman* PacmanGame;
     
    7487            bool bShowMessage_;
    7588            bool bShowGhoststatus_;
     89            bool showgameover;
     90            bool showlive;
    7691            int messageID;
    7792    };
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc

    r11976 r11978  
    7575    {
    7676        resetposition = this->getPosition();
    77       if((abs(resetposition.x - playerpos.x)<5) && (abs(resetposition.z - playerpos.z)<5)){
     77      if((abs(resetposition.x - playerpos.x)<5) && (abs(resetposition.y - playerpos.y)<5) && (abs(resetposition.z - playerpos.z)<5)){
    7878        this->setPosition(Vector3(resetposition.x, -50, resetposition.z));
    7979        return true;
Note: See TracChangeset for help on using the changeset viewer.