- Timestamp:
- May 5, 2018, 12:12:36 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
r11944 r11945 70 70 if(timer<=0){ 71 71 afraid = false; 72 t imer = 0;72 this->setNormal(); 73 73 } 74 74 } … … 88 88 89 89 bcolli = false; 90 for(int nrghost = 0; (nrghost< 3) && (!bcolli); ++nrghost){90 for(int nrghost = 0; (nrghost<8) && (!bcolli); ++nrghost){ 91 91 bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition); 92 92 //orxout() << "GHOST" << nrghost << ghosts[nrghost]->getPosition() << endl; … … 127 127 } 128 128 else{ 129 for(int nrghost = 0; nrghost< 3; ++nrghost){129 for(int nrghost = 0; nrghost<8; ++nrghost){ 130 130 bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition); 131 131 if(bcolli) ghosts[nrghost]->resetGhost(); … … 136 136 137 137 void Pacman::setAfraid(){ 138 afraid = true; 138 139 139 timer = 10; //Set timer to 10 seconds 140 141 //Change normal Ghosts with afraid ones 142 if(!afraid){ 143 ghosts[0]->changewith(ghosts[4]); 144 ghosts[1]->changewith(ghosts[5]); 145 ghosts[2]->changewith(ghosts[6]); 146 ghosts[3]->changewith(ghosts[7]); 147 } 148 149 afraid = true; 150 } 151 152 void Pacman::setNormal(){ 153 154 timer = 0; 155 156 //Change normal Ghosts with afraid ones 157 if(afraid){ 158 ghosts[4]->changewith(ghosts[0]); 159 ghosts[5]->changewith(ghosts[1]); 160 ghosts[6]->changewith(ghosts[2]); 161 ghosts[7]->changewith(ghosts[3]); 162 } 163 164 afraid = false; 140 165 } 141 166
Note: See TracChangeset
for help on using the changeset viewer.