Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2018, 3:45:20 PM (7 years ago)
Author:
dreherm
Message:

Afraid Ghosts

File:
1 edited

Legend:

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

    r11931 r11933  
    9696        }
    9797
     98        for(PacmanPointAfraid* next : ObjectList<PacmanPointAfraid>()){
     99            if(collis(next->getPosition(), currentPosition)){
     100                setAfraid();
     101            }
     102        }
     103
    98104    }
    99105
     
    106112
    107113    void Pacman::catched(){
     114
     115    if(!afraid) {
    108116        if(!lives) this->end();
    109117        --lives;
    110118        this->posreset();
     119        }
     120    else{
     121
     122        for(int nrghost = 0; nrghost<3; ++nrghost){
     123        bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
     124        if(bcolli) ghosts[nrghost]->resetGhost();
     125        bcolli = false;
     126        }
     127      }
     128    }
     129
     130    void setAfraid(){
     131        afraid = true;
    111132    }
    112133
Note: See TracChangeset for help on using the changeset viewer.