Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 26, 2018, 4:11:19 PM (6 years ago)
Author:
dreherm
Message:

Game playable

File:
1 edited

Legend:

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

    r11898 r11915  
    3838namespace orxonox
    3939{
    40     RegisterUnloadableClass(Pacman);
     40    RegisterClass(Pacman);
    4141
    4242    Pacman::Pacman(Context* context) : Deathmatch(context)
     
    4444        RegisterObject(Pacman);
    4545
    46         lives = 3;
     46        lives = 10;
    4747        point = 0;
    4848        level = 1;
     
    5757
    5858    PacmanGhost* ghosts[4];
    59     PacmanPointSphere* spheres[1];
    6059
    6160
    6261    void Pacman::tick(float dt)
    6362    {
     63        SUPER(Pacman, tick, dt);
     64
    6465        int i = 0;
    6566        for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
     
    7475        }
    7576
     77
    7678        bcolli = false;
    7779        for(int nrghost = 0; (nrghost<3) && (!bcolli); ++nrghost){
    7880            bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
     81            //orxout() << "GHOST" << nrghost << ghosts[nrghost]->getPosition() << endl;
    7982        }
     83
    8084        if(bcolli){
    81             this->catched();
     85          this->catched();
    8286        }
    8387
     
    8993        }
    9094
    91         SUPER(Pacman, tick, dt);
    92 
    9395    }
    9496
    9597
    9698    bool Pacman::collis(Vector3 one, Vector3 other){
    97         if((abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1) && (abs(one.x-other.x)<0.1))
     99        if((abs(one.x-other.x)<7) && (abs(one.y-other.y)<7) && (abs(one.z-other.z)<7))
    98100            return true;
    99101        return false;
     
    107109
    108110    void Pacman::posreset(){
    109         int i = 0;
    110111        for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
    111112            nextghost->resetGhost();
    112             i++;
    113113        }
    114114        player->setPosition(startposplayer);
     
    118118        ++point;
    119119        if(point == totallevelpoint) this->levelUp();
    120 
    121120        Vector3 postaken = taken->getPosition();
    122121        postaken.y = -50;
     
    141140    void Pacman::start()
    142141    {
    143         orxout() << "start" << endl;
    144        
    145142        Deathmatch::start();
    146     }
    147 
    148     void Pacman::playerPreSpawn(PlayerInfo* player)
    149     {
    150         //PlayerInfo* playerInfo_;
    151         //this->playerInfo_ = player;
    152         if(lives <= 0)
    153         {
    154             this->end();
    155         }
    156143    }
    157144
Note: See TracChangeset for help on using the changeset viewer.