Changeset 11976 for code/branches/3DPacman_FS18/src
- Timestamp:
- May 17, 2018, 4:14:35 PM (7 years ago)
- Location:
- code/branches/3DPacman_FS18/src/modules/pacman
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
r11958 r11976 45 45 46 46 // firstGame = true; //needed for the HUD 47 lives = 3;47 lives = 0; 48 48 point = 0; 49 49 level = 1; … … 77 77 SUPER(Pacman, tick, dt); 78 78 79 //orxout() << timer << endl; 80 //orxout() << afraid << endl; 81 //orxout() << totallevelpoint << endl; 82 79 if(deathtime != 0){ 80 dead(dt); 81 } 82 83 else{ 83 84 84 85 if(afraid){ 85 86 timer = timer - dt; 86 87 if(timer<=0){ 87 88 setNormal(); 88 89 } 89 90 } 91 90 92 91 93 int i = 0; … … 109 111 110 112 if(bcolli){ 111 this->catched( );113 this->catched(dt); 112 114 } 113 115 … … 125 127 } 126 128 129 } 130 131 132 133 127 134 } 128 135 … … 134 141 } 135 142 136 void Pacman::catched( ){143 void Pacman::catched(float dt){ 137 144 138 145 if(!afraid) { 139 if(!lives) this->end(); 146 if(!lives){ 147 deathtime = 5; 148 this->dead(dt); 149 } 140 150 --lives; 141 151 this->posreset(); … … 225 235 } 226 236 237 bool Pacman::isdead(){ 238 return death; 239 } 240 241 void Pacman::dead(float dt){ 242 death = true; 243 244 deathtime = deathtime-dt; 245 246 if(deathtime<0) 247 this->end(); 248 } 227 249 228 250 void Pacman::end() -
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
r11956 r11976 75 75 void levelUp(); 76 76 bool collis(Vector3 one, Vector3 other); 77 void catched( );77 void catched(float dt); 78 78 void posreset(); 79 79 void takePoint(PacmanPointSphere* taken); … … 82 82 void setAfraid(); 83 83 void setNormal(); 84 bool isdead(); 85 void dead(float dt); 84 86 85 87 … … 100 102 //bool firstGame; 101 103 bool afraid = false; 104 bool death = false; 105 float deathtime = 0; 102 106 103 107 private: -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
r11959 r11976 439 439 440 440 void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){ 441 if(!dontmove) 441 if(!dontmove){ 442 442 this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt)); 443 444 445 if(abs(velocity.x) == 2){ 446 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); 447 } 448 else if(velocity.z == 2){ 449 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); 450 } 451 else if(velocity.z == -2){ 452 this->setOrientation(Quaternion(Radian(180), Vector3(0, 1, 0))); 453 } 454 else{} 455 456 } 443 457 } 444 458 -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
r11961 r11976 68 68 if (this->PacmanGame) 69 69 { 70 if(this->bShowPoints_){ 70 bool death = this->PacmanGame->isdead(); 71 if(death){ 72 bShowPoints_ = false; 73 bShowGhoststatus_ = false; 74 const std::string& deathmessage = "Game Over"; 75 setTextSize(0.4); 76 this->setCaption(deathmessage); 77 } 78 79 if(this->bShowPoints_ && !death) { 71 80 const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->totallevelpoint); 72 81 setTextSize(0.04); 73 82 this->setCaption(points); 74 } 75 if(this->bShowGhoststatus_){ 83 } 84 85 if(this->bShowGhoststatus_ && !death){ 76 86 const std::string& ghoststatus = "Do not get caught!"; 77 //if(this->PacmanGame->afraid) const std::string& ghoststatus = "Catch the ghosts!"; 78 orxout() << "Test Hier" << endl; 87 if(this->PacmanGame->afraid) const std::string& ghoststatus = "Catch the ghosts!"; 79 88 setTextSize(0.04); 80 89 this->setCaption(ghoststatus); 81 90 } 82 91 } 83 92 } -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
r11961 r11976 63 63 { return messageID; } 64 64 65 inline void setGhoststatus( intvalue){65 inline void setGhoststatus(bool value){ 66 66 this->bShowGhoststatus_ = value; 67 67 } -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
r11956 r11976 75 75 { 76 76 resetposition = this->getPosition(); 77 if((abs(resetposition.x - playerpos.x)< 1) && (abs(resetposition.z - playerpos.z)<1)){77 if((abs(resetposition.x - playerpos.x)<5) && (abs(resetposition.z - playerpos.z)<5)){ 78 78 this->setPosition(Vector3(resetposition.x, -50, resetposition.z)); 79 79 return true;
Note: See TracChangeset
for help on using the changeset viewer.