Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2018, 3:36:40 PM (7 years ago)
Author:
dreherm
Message:

Testversion 1

Location:
code/branches/3DPacman_FS18/src/modules/pacman
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc

    r11984 r11992  
    247247    bool Pacman::isdead(){
    248248        return death;
     249    }
     250    //Getter
     251    int Pacman::getTotalpoints(){
     252        return totallevelpoint;
    249253    }
    250254
     
    272276        death = true;
    273277
    274         //if (Highscore::exists())
    275           //  Highscore::getInstance().storeScore("3DPacman", this->getPoints(), this->playerInfo_);
    276 
    277278        deathtime = deathtime-dt;
    278279
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h

    r11979 r11992  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Marc Dreher
    2424 *   Co-authors:
    2525 *      ...
     
    4040#include "PacmanPointSphere.h"
    4141#include "PacmanPointAfraid.h"
    42 #include "Highscore.h"
    43 //#include "PlayerInfo.h"
    4442
    4543
     
    7371            virtual void tick(float dt) override;
    7472
     73            PacmanGelb* getPlayer();
     74            int getPoints();
     75            bool getAfraid();
     76            int getTimer();
     77            int getLives();
     78            int getLevel();
     79            int getTotalpoints();
     80            bool isdead();
     81           
     82       private:
     83
    7584            void levelUp();
    7685            bool collis(Vector3 one, Vector3 other);
     
    7887            void posreset();
    7988            void takePoint(PacmanPointSphere* taken);
    80             PacmanGelb* getPlayer();
    81             int getPoints();
    8289            void setAfraid();
    8390            void setNormal();
    84             bool isdead();
    8591            void dead(float dt);
    86             bool getAfraid();
    87             int getTimer();
    88             int getLives();
    89             int getLevel();
    9092
    91 
    92             bool bEndGame;
    93             bool bShowLevel;
    94             int lives;
    95             int multiplier;
    96             float counter;
    97             int pattern;
    98             float lastPosition;
    99 
     93            PacmanGelb* player;
    10094            Vector3 currentPosition;
    101             PacmanGelb* player;
     95            Vector3 startposplayer = Vector3(0,10,150);
    10296            bool bcolli = false;
    103             float timer = 0;
    104             Vector3 startposplayer = Vector3(0,10,150);
     97           
    10598            int totallevelpoint;
    106             //bool firstGame;
     99           
    107100            bool afraid = false;
    108101            bool death = false;
    109102            float deathtime = 0;
    110            
    111        private:
     103            float timer = 0;
    112104
    113 
    114             Timer endGameTimer;
    115105            int level;
    116106            int point;
    117             bool b_combo;
    118 
    119             Timer enemySpawnTimer;
    120             Timer comboTimer;
    121             Timer showLevelTimer;
    122 
    123 /*
    124 std::string sDeathMessage;
    125 const std::vector<std::string> DeathMessage7 = {
    126                 "You should really try that again",
    127                 "You can do better, can you?",
    128                 "Hey, maybe you get a participation award, that's good isn't it?",
    129                 "Congratulations, you get a medal, a wooden one",
    130                 "That was flappin bad!",
    131                 "Well, that was a waste of time",
    132                 "You suck!",
    133                 "Maybe try SuperOrxoBros. That game is not as hard.",
    134                 "Here's a tip: Try not to fly into these grey thingies.",
    135                 "We won't comment on that."};
    136             const std::vector<std::string> DeathMessage20 = {
    137                 "Getting better!",
    138                 "Training has paid off, huh?",
    139                 "Good average!",
    140                 "That was somehow enjoyable to watch",
    141                 "Flappin average",
    142                 "Getting closer to something",
    143                 "That wasn't crap, not bad",
    144                 "Surprisingly not bad."};
    145   */     
     107            int lives;
    146108       
    147109    };
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc

    r11979 r11992  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      Marc Dreher
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *      ..
    2626 *
    2727 */
     
    6262    /**
    6363    @brief
    64         Destructor. Destroys controller, if present.
     64        Destructor. Destroys ghost, if present.
    6565    */
    6666    PacmanGhost::~PacmanGhost()
     
    7171    /**
    7272    @brief
    73         Method for creating a AutonomousDrone through XML.
     73        Method for creating a ghost through XML.
    7474    */
    7575    void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    7979
    8080
    81 
     81    //All positions in the map, see documentation
    8282    Vector3 possibleposition[] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-4
    8383        Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9
     
    9797    /**
    9898    @brief
    99         Defines which actions the AutonomousDrone has to take in each tick.
     99        Defines which actions the ghost has to take in each tick.
    100100    @param dt
    101101        The length of the tick.
     
    104104    {
    105105        SUPER(PacmanGhost, tick, dt);
    106 
    107         //setorientation
    108106
    109107        this->actuelposition = this->getPosition();
     
    340338    }
    341339
     340    //Random choice of new target (not used in game, but useful)
    342341    void PacmanGhost::setnewTarget(int firstdec){
    343342       
     
    352351    }
    353352
     353    //Random choice of new target
    354354    void PacmanGhost::setnewTarget(int firstdec, int seconddec){
    355355           decision = rand()%2;
     
    369369    }
    370370
     371    //Random choice of new target
    371372    void PacmanGhost::setnewTarget(int firstdec, int seconddec, int thirddec){
    372373       
     
    392393        }
    393394
     395    //Random choice of new target
    394396    void PacmanGhost::setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec){
    395397       
     
    420422        }
    421423
     424    //Change this with other ghost
    422425    void PacmanGhost::changewith(PacmanGhost* otherghost){
    423426
    424427        while(lockmove){};
    425         lockmove = true;
     428        lockmove = true;    //Prevent change of target while ghost is changed
    426429
    427430        otherghost->setPosition(this->getPosition());
    428431        this->setPosition(0,-20,0);
    429         otherghost->target_x = this->target_x;   //Probleme bei parallelen Porzessen
     432        otherghost->target_x = this->target_x;   
    430433        otherghost->target_z = this->target_z;
    431434        otherghost->ismoving = this->ismoving;
     
    437440    }
    438441
    439 
     442    //Move ghost with rotation
    440443    void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
    441444        if(!dontmove){
    442445            this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt));
     446       
     447        //Rotate ghost in the direction of movement
    443448        if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1))
    444449            if(velocity.x<0){
     
    455460                 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); 
    456461            }
    457             this->getOrientation();
    458462                     
    459463     }
    460464    }
    461465
     466    //Check if there is a collision
    462467    bool PacmanGhost::findpos(Vector3 one, Vector3 other){
    463468       if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true;
     
    465470    }
    466471
     472    //Change ability to move
    467473    void PacmanGhost::changemovability(){
    468474        if(dontmove){
     
    473479    }
    474480
     481    //ResetGhost
    475482    void PacmanGhost::resetGhost(){
    476483   
     
    484491    }
    485492
     493    //Increase speed of ghosts
    486494    void PacmanGhost::levelupvelo(){
    487495        speed ++;
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h

    r11979 r11992  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      Marc Dreher
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *      ..
    2626 *
    2727 */
     
    3535
    3636#include "worldentities/ControllableEntity.h"
    37 //Test
     37
    3838namespace orxonox {
    3939
     
    5151            void resetGhost();
    5252
    53             void setnewTarget(int firstdec);
    54             void setnewTarget(int firstdec, int seconddec);
    55             void setnewTarget(int firstdec, int seconddec, int thirddec);
    56             void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec);
    5753            void changewith(PacmanGhost* otherghost);
    5854            void levelupvelo();
     
    6157            void changemovability();
    6258            bool dontmove = false;
    63             bool lockmove = false;
     59
     60        private:
     61            int decision = 0;
     62            Vector3 resetposition = Vector3(0,10,15);
     63            Vector3 velocity;
     64            int speed = 20;
    6465
    6566            Vector3 actuelposition;
     
    6768            int target_x = 0;
    6869            int target_z = 0;
    69             Vector3 velocity;
    70             Vector3 oldvelocity = Vector3(2,0,0);
    71             int speed = 20;
     70            bool lockmove = false;
    7271
    73         private:
    74             int decision = 0; //Gives the random which way information to the ghost.
    75             Vector3 resetposition = Vector3(0,10,15);
     72            void setnewTarget(int firstdec);
     73            void setnewTarget(int firstdec, int seconddec);
     74            void setnewTarget(int firstdec, int seconddec, int thirddec);
     75            void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec);
    7676    };
    7777
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc

    r11979 r11992  
    2121 *
    2222 *   Author:
    23  *      Leo Merholz
    24  *      Pascal Schärli
    25  *
     23 *      Marc Dreher
     24
    2625 *      Co-authors:
    2726 *      ...
     
    7978           
    8079            if(this->bShowPoints_) {
    81                     const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->totallevelpoint);
     80                    const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->getTotalpoints());
    8281                    setTextSize(0.03);
    8382                    this->setCaption(points);
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h

    r11979 r11992  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Marc Dreher
    2424 *
    2525 */
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc

    r11979 r11992  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      Marc Dreher
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *     
    2626 *
    2727 */
     
    5959    /**
    6060    @brief
    61         Method for creating a AutonomousDrone through XML.
     61        Method for creating a PacmanPointAfraid through XML.
    6262    */
    6363    void PacmanPointAfraid::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    7272    }
    7373
     74    //Check for collision
    7475    bool PacmanPointAfraid::taken(Vector3 playerpos)
    7576    {
     
    8384    }
    8485
    85 
     86    //Reset position
    8687    void PacmanPointAfraid::resetPacmanPointAfraid(){
    8788        resetposition = this->getPosition();
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.h

    r11956 r11992  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      Marc Dreher
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *   
    2626 *
    2727 */
     
    4444            virtual ~PacmanPointAfraid();
    4545
    46             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
    47             virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
     46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     47            virtual void tick(float dt);
    4848
    4949            bool taken(Vector3 playerpos);
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc

    r11979 r11992  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      Marc Dreher
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *     
    2626 *
    2727 */
     
    7272    }
    7373
     74    //Check for collision
    7475    bool PacmanPointSphere::taken(Vector3 playerpos)
    7576    {
     
    8384    }
    8485
    85 
     86    //Reset position
    8687    void PacmanPointSphere::resetPacmanPointSphere(){
    8788        resetposition = this->getPosition();
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h

    r11915 r11992  
    2121 *
    2222 *   Author:
    23  *      Oli Scheuss
     23 *      Marc Dreher
    2424 *   Co-authors:
    25  *      Damian 'Mozork' Frick
     25 *     
    2626 *
    2727 */
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h

    r11898 r11992  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Marc Dreher
    2424 *   Co-authors:
    2525 *      ...
Note: See TracChangeset for help on using the changeset viewer.