- Timestamp:
- May 3, 2018, 3:45:20 PM (7 years ago)
- Location:
- code/branches/3DPacman_FS18
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS18/data/levels/3DPacman.oxw
r11931 r11933 59 59 </PacmanGhost> 60 60 61 62 63 64 65 <PacmanGhost position="0,-20,0" > 66 <attached> 67 <Model position="0,0,0" mesh="PacmanGhostAfraid.mesh" scale="5" /> 68 </attached> 69 </PacmanGhost> 70 71 <PacmanPointAfraid position="215,10,195"> 72 <attached> 73 <Model position="0,0,0" mesh="PacmanPointAfraid.mesh" scale="5" /> 74 </attached> 75 </PacmanPointAfraid> 76 77 78 79 61 80 <!-- POINTS --> 62 81 <PacmanPointSphere position="0,10,0"> … … 78 97 </PacmanPointSphere> 79 98 99 <PacmanPointAfraid position="215,10,195"> 100 <attached> 101 <Model position="0,0,0" mesh="PacmanPointAfraid.mesh" scale="5" /> 102 </attached> 103 </PacmanPointAfraid> 80 104 81 105 <!-- Map --> -
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
r11931 r11933 96 96 } 97 97 98 for(PacmanPointAfraid* next : ObjectList<PacmanPointAfraid>()){ 99 if(collis(next->getPosition(), currentPosition)){ 100 setAfraid(); 101 } 102 } 103 98 104 } 99 105 … … 106 112 107 113 void Pacman::catched(){ 114 115 if(!afraid) { 108 116 if(!lives) this->end(); 109 117 --lives; 110 118 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; 111 132 } 112 133 -
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
r11931 r11933 39 39 #include "PacmanGhost.h" 40 40 #include "PacmanPointSphere.h" 41 #include "PacmanPointAfraid.h" 41 42 #include "Highscore.h" 42 43 //#include "PlayerInfo.h" … … 95 96 int totallevelpoint = 3; 96 97 //bool firstGame; 98 bool afraid = false; 99 float timer = 0; 97 100 98 101 private: -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
r11931 r11933 417 417 418 418 void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){ 419 this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt)); 419 if(!dontmove) 420 this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt)); 420 421 } 421 422 … … 423 424 if((abs(one.x - other.x)<0.5) && (abs(one.z - other.z)<0.5)) return true; 424 425 return false; 426 } 427 428 void changemovability(){ 429 if(dontmove){ 430 dontmove = false;} 431 else{ 432 dontmove = true; 433 } 425 434 } 426 435 -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
r11931 r11933 58 58 59 59 bool findpos(Vector3 one, Vector3 other); 60 60 void changemovability(); 61 61 62 62 private: 63 bool dontmove = false; 63 64 bool ismoving = false; 64 65 int decision = 0; //Gives the random which way information to the ghost.
Note: See TracChangeset
for help on using the changeset viewer.