Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 22, 2019, 1:58:40 PM (6 years ago)
Author:
wiesep
Message:

Merged 3DPacman_FS19

Location:
code/branches/Presentation_FS19
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Presentation_FS19

  • code/branches/Presentation_FS19/src/modules/pacman/Pacman.cc

    r12003 r12408  
    3939    RegisterClass(Pacman);
    4040
     41    int PACMAN_INTERNAL_PACMAN_POSITION;
     42
    4143    Pacman::Pacman(Context* context) : Deathmatch(context)
    4244    {
     
    4648        point = 0;
    4749        level = 1;
     50        laser = 5; //after that number of eaten pointSpheres, the laser appears
    4851
    4952    }
     
    5659        }
    5760
     61       
     62        PacmanLaser* pos = *(ObjectList<PacmanLaser>().begin());
     63        pos->resetPacmanLaser();
     64
     65
     66
    5867        for(PacmanPointAfraid* next : ObjectList<PacmanPointAfraid>()){
    5968            next->resetPacmanPointAfraid();
     
    7382
    7483
    75     PacmanGhost* ghosts[4];
     84    PacmanGhost* ghosts[8];
    7685
    7786
    7887    void Pacman::tick(float dt)
    7988    {
     89
    8090        SUPER(Pacman, tick, dt);
     91
    8192
    8293        //Needed for gameover
    8394        if(deathtime != 0){
    8495            dead(dt);
     96
     97
     98         
    8599        }
    86100
     
    88102        else{
    89103
     104            //support by laser
     105            if(point > laser + 240*(level-1)){
     106             
     107                for(PacmanPointSphere* pointer : ObjectList<PacmanPointSphere>()){
     108                    Vector3 pointSpherePosition = pointer->getPosition();
     109
     110                     if(pointSpherePosition.y > 0){// pointSphere above surface =not eaten yet
     111
     112                        PacmanLaser* pos = *(ObjectList<PacmanLaser>().begin());
     113                        pos->setPosition(pointSpherePosition);
     114                        break;
     115                    }
     116
     117
     118                }
     119
     120            }
     121
    90122            //Register ghosts
    91123            int i = 0;
    92             for(PacmanGhost* nextghost : ObjectList<PacmanGhost>()){
     124            for(PacmanGhost* nextghost: ObjectList<PacmanGhost>()){
    93125                ghosts[i] = nextghost;
    94126                i++;
    95127            }
    96 
    97128            //Switch ghost to not-catchable, if timer is zero
    98129            if(afraid){
     
    137168    //Check for collisions between to objects (compare float numbers)
    138169    bool Pacman::collis(Vector3 one, Vector3 other){
    139         if((abs(one.x-other.x)<10) && (abs(one.y-other.y)<10) && (abs(one.z-other.z)<10))
     170        if((abs(one.x-other.x)<19) && (abs(one.y-other.y)<10) && (abs(one.z-other.z)<19))
    140171            return true;
    141172        return false;
     
    203234    void Pacman::takePoint(PacmanPointSphere* taken){
    204235        ++point;
     236       
    205237        if(point == totallevelpoint){
    206238            this->levelUp();
Note: See TracChangeset for help on using the changeset viewer.