Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11984


Ignore:
Timestamp:
May 24, 2018, 2:25:15 PM (6 years ago)
Author:
dreherm
Message:

Added level info

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

Legend:

Unmodified
Added
Removed
  • code/branches/3DPacman_FS18/data/levels/3DPacman.oxw

    r11976 r11984  
    22 name = "3DPacman"
    33 description = "A 3DVersion of Pacman."
    4  tags = "test"
    5  screenshot = "emptylevel.png"
     4 tags = "minigame"
     5 screenshot = "Pacman.png"
    66/>
    77
     
    1616?>
    1717
    18 <!-- include("templates/spaceshipEscort.oxt") -->
    19 
    2018<Level
    2119  plugins = pacman
     
    3533    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    3634    <SpawnPoint team=0 position="0,10,150" lookat="0,0,0" spawnclass=PacmanGelb pawndesign=PacmanGelb />
    37 
    38     <!-- <SpawnPoint team=0 position="0,10,150" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort /> -->
    3935
    4036<!-- GHOSTS -->
     
    18051801  <BoxCollisionShape position="155,10,130" halfExtents="10,30,25" />
    18061802  <BoxCollisionShape position="-220,10,150" halfExtents="20,30,10" />
    1807   <BoxCollisionShape position="-220,10,150" halfExtents="20,30,10" /> <!-- 30 -->
     1803  <BoxCollisionShape position="220,10,150" halfExtents="20,30,10" /> <!-- 30 -->
    18081804  <BoxCollisionShape position="0,10,150" halfExtents="60,30,10" />
    18091805  <BoxCollisionShape position="0,10,180" halfExtents="10,30,25" />
     
    18171813</StaticEntity>
    18181814
    1819 <PortalEndPoint position="-240,10,0" id="1" distance="40" target="Pawn"/>
    1820 <PortalEndPoint position="240,10,0" id="2" distance="40" target="Pawn"/>
     1815
     1816<Template name=Portal>
     1817    <PortalEndPoint>
     1818        <attached>
     1819            <Model mesh="Spacegate.mesh" yaw="90"/>
     1820        </attached>
     1821    </PortalEndPoint>
     1822</Template>
     1823
     1824<PortalEndPoint position="-240,15,5" id="1" distance="40" target="Pawn" design="Portal"/>
     1825<PortalEndPoint position="240,15,5" id="2" distance="40" target="Pawn" design="Portal"/>
    18211826<PortalLink fromID="1" toID="2" />
    18221827<PortalLink fromID="2" toID="1" />
  • code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo

    r11979 r11984  
    5959
    6060    <PacmanHUDinfo
    61      position  = "0.5, 0.5"
     61     position  = "0.85, 0.9"
    6262     pickpoint = "0.0, 0.0"
    6363     font      = "ShareTechMono"
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc

    r11979 r11984  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Marc Dreher
    2424 *   Co-authors:
    2525 *      ...
     
    3434#include "Pacman.h"
    3535#include "core/CoreIncludes.h"
    36 //Test
    3736
    3837namespace orxonox
     
    5251    void Pacman::levelUp()
    5352    {
     53        //Reset each object
    5454        for(PacmanPointSphere* nextsphere : ObjectList<PacmanPointSphere>()){
    5555                nextsphere->resetPacmanPointSphere();
     
    6060        }
    6161
     62        //Level up ghosts
    6263        for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
    6364            nextghost->levelupvelo();
    6465        }
     66        //Reset ghosts and player
    6567        this->posreset();
    6668
     69        //Increase maximum of points and level
    6770        totallevelpoint = ObjectList<PacmanPointSphere>().size() + totallevelpoint;
    6871        level++;
     
    7780        SUPER(Pacman, tick, dt);
    7881
     82        //Needed for gameover
    7983        if(deathtime != 0){
    8084            dead(dt);
    8185        }
    8286
     87        //ingame loop
    8388        else{
    8489
    85         if(afraid){
    86         timer = timer - dt;
    87             if(timer<=0){
    88                 setNormal();
    89             }
    90         }
    91 
    92 
    93         int i = 0;
    94         for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
    95             ghosts[i] = nextghost;
    96             i++;
    97         }
    98 
    99         player = this->getPlayer();
    100         if (player != nullptr)
    101         {
    102             currentPosition = player->getWorldPosition();
    103         }
    104 
    105 
    106         bcolli = false;
    107         for(int nrghost = 0; (nrghost<8) && (!bcolli); ++nrghost){
    108             bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
    109             //orxout() << "GHOST" << nrghost << ghosts[nrghost]->getPosition() << endl;
    110         }
    111 
    112         if(bcolli){
    113           this->catched(dt);
    114         }
    115 
    116         i = 0;
    117         for(PacmanPointSphere* nextsphere : ObjectList<PacmanPointSphere>()){
    118             if(collis(nextsphere->getPosition(), currentPosition)){
    119                 takePoint(nextsphere);
    120             }
    121         }
    122 
    123         for(PacmanPointAfraid* next : ObjectList<PacmanPointAfraid>()){
    124             if(next->taken(currentPosition)){
    125                 setAfraid();
    126             }
    127         }
     90            //Register ghosts
     91            int i = 0;
     92            for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
     93                ghosts[i] = nextghost;
     94                i++;
     95            }
     96
     97            //Switch ghost to not-catchable, if timer is zero
     98            if(afraid){
     99                timer = timer - dt;
     100                if(timer<=0){
     101                    setNormal();
     102                }
     103            }
     104
     105            //Get position of player
     106            player = this->getPlayer();
     107            if (player != nullptr)
     108            {
     109                currentPosition = player->getWorldPosition();
     110            }
     111
     112            //Check for collision with ghosts
     113            bcolli = false;
     114            for(int nrghost = 0; (nrghost<8) && (!bcolli); ++nrghost){
     115                bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
     116            }
     117
     118            if(bcolli){
     119                this->catched(dt);
     120            }
     121
     122            //Check for collision with PointSpheres and PacmanPointAfraid
     123            i = 0;
     124            for(PacmanPointSphere* nextsphere : ObjectList<PacmanPointSphere>()){
     125                if(collis(nextsphere->getPosition(), currentPosition))
     126                 takePoint(nextsphere);
     127            }
     128
     129            for(PacmanPointAfraid* next : ObjectList<PacmanPointAfraid>()){
     130                if(next->taken(currentPosition))
     131                  setAfraid();
     132            }
    128133
    129134        }
     
    131136    }
    132137
    133 
     138    //Check for collisions between to objects (compare float numbers)
    134139    bool Pacman::collis(Vector3 one, Vector3 other){
    135140        if((abs(one.x-other.x)<10) && (abs(one.y-other.y)<10) && (abs(one.z-other.z)<10))
     
    138143    }
    139144
     145    //Decrease live or resetghost
    140146    void Pacman::catched(float dt){
    141147
    142     if(!afraid) {
    143         if(!lives){
     148    if(!this->afraid) {
     149        if(!this->lives){
    144150          deathtime = 5;
    145151          this->dead(dt); 
     
    150156    else{
    151157        for(int nrghost = 0; nrghost<8; ++nrghost){
    152         bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
    153         if(bcolli) ghosts[nrghost]->resetGhost();
    154         bcolli = false;
     158            bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
     159            if(bcolli) ghosts[nrghost]->resetGhost();
     160                bcolli = false;
    155161        }
    156162      }
    157163    }
    158164
     165    //Change ghost design (to afraid)
    159166    void Pacman::setAfraid(){
    160167
     
    172179    }
    173180
     181    //Change ghost design (to not afraid)
    174182    void Pacman::setNormal(){
    175183
     
    185193    }
    186194
    187     bool Pacman::getAfraid(){
    188         return afraid;
    189     }
    190 
    191     int Pacman::getTimer(){
    192         return timer;
    193     }
    194 
    195     int Pacman::getLevel(){
    196         return level;
    197     }
    198 
     195    //Reset ghosts and plazer
    199196    void Pacman::posreset(){
    200197        for(int i = 0; i<4; ++i){
     
    204201    }
    205202
     203    //Collision with PointSphere
    206204    void Pacman::takePoint(PacmanPointSphere* taken){
    207205        ++point;
     
    210208            return;
    211209        }
     210        //Set PointSphere under map
    212211        Vector3 postaken = taken->getPosition();
    213212        postaken.y = -50;
     
    225224    }
    226225
     226    //Getter
     227    bool Pacman::getAfraid(){
     228        return afraid;
     229    }
     230    //Getter
     231    int Pacman::getTimer(){
     232        return timer;
     233    }
     234    //Getter
     235    int Pacman::getLevel(){
     236        return level;
     237    }
     238    //Getter
    227239    int Pacman::getPoints(){
    228240        return point;
    229241    }
    230 
     242    //Getter
    231243    int Pacman::getLives(){
    232244        return lives;
    233245    }
     246    //Getter
     247    bool Pacman::isdead(){
     248        return death;
     249    }
    234250
    235251
     
    238254        Deathmatch::start();
    239255
     256        //Hide afraided ghosts under map
    240257        int i = 0;
    241258        for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
     
    247264        }
    248265
     266        //Set maximum of points of first level
    249267        totallevelpoint = ObjectList<PacmanPointSphere>().size();
    250268
    251     }
    252 
    253     bool Pacman::isdead(){
    254         return death;
    255269    }
    256270
     
    258272        death = true;
    259273
     274        //if (Highscore::exists())
     275          //  Highscore::getInstance().storeScore("3DPacman", this->getPoints(), this->playerInfo_);
     276
    260277        deathtime = deathtime-dt;
    261278
     
    266283    void Pacman::end()
    267284    {
    268 
    269         /*
    270         if (Highscore::exists())
    271         {
    272             //int score = this->getPoints();
    273             //Highscore::getInstance().storeScore("3DPacman", score, this->playerInfo_);
    274         }
    275         */
    276285        GSLevel::startMainMenu();
    277286    }
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc

    r11978 r11984  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Marc Dreher
    2424 *   Co-authors:
    2525 *      ...
     
    4747    {
    4848        SUPER(PacmanGelb, tick, dt);
    49         //bring player back to ground
    50         actuelposition = this->getPosition();
     49        actuelposition = this->getPosition(); //bring player back to ground
    5150        actuelposition.y = 10;
    5251        this->setPosition(actuelposition);
    53         this->rotatePitch(Vector2(0, 0));
    54 
    55        
    5652    }
    5753}
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h

    r11979 r11984  
    2121 *
    2222 *   Author:
    23  *      Florian Zinggeler
     23 *      Marc Dreher
    2424 *   Co-authors:
    2525 *      ...
     
    5252            virtual void tick(float dt);
    5353
    54             //no rotation
     54            //allow rotation in horizontal manner
    5555            virtual void rotateYaw(const Vector2& value) override{
    5656                this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x);
    57 
    5857                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)));
    6358            };
     59           
     60            //forbid rotation in the vertical (doesn't work totally proper, see documentation)
    6461            virtual void rotatePitch(const Vector2& value) override{};
    6562
    6663        private:
    6764            Vector3 actuelposition;
    68             Quaternion actuelorient;
    6965       
    7066    };
Note: See TracChangeset for help on using the changeset viewer.