Changeset 11978 for code/branches/3DPacman_FS18/src/modules/pacman
- Timestamp:
- May 18, 2018, 12:38:37 PM (6 years ago)
- Location:
- code/branches/3DPacman_FS18/src/modules/pacman
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
r11976 r11978 44 44 RegisterObject(Pacman); 45 45 46 // firstGame = true; //needed for the HUD 47 lives = 0; 46 lives = 3; 48 47 point = 0; 49 48 level = 1; 50 49 51 // setHUDTemplate("PacmanOrxHUD");52 // scoreboardTemplate_ = "";53 50 } 54 51 … … 188 185 } 189 186 187 bool Pacman::getAfraid(){ 188 return afraid; 189 } 190 191 int Pacman::getTimer(){ 192 return timer; 193 } 194 190 195 void Pacman::posreset(){ 191 196 for(int i = 0; i<4; ++i){ … … 215 220 int Pacman::getPoints(){ 216 221 return point; 222 } 223 224 int Pacman::getLives(){ 225 return lives; 217 226 } 218 227 -
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
r11976 r11978 84 84 bool isdead(); 85 85 void dead(float dt); 86 bool getAfraid(); 87 int getTimer(); 88 int getLives(); 86 89 87 90 -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.cc
r11898 r11978 51 51 actuelposition.y = 10; 52 52 this->setPosition(actuelposition); 53 this->rotatePitch(Vector2(0, 0)); 54 55 53 56 } 54 57 } -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h
r11898 r11978 42 42 #include "graphics/Camera.h" 43 43 44 44 45 namespace orxonox 45 46 { … … 52 53 53 54 //no rotation 54 //virtual void rotateYaw(const Vector2& value) override{}; 55 virtual void rotateYaw(const Vector2& value) override{ 56 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x); 57 58 Pawn::rotateYaw(value); 59 60 // This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling. 61 if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_) 62 this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().y))); 63 }; 55 64 virtual void rotatePitch(const Vector2& value) override{}; 56 65 -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
r11976 r11978 441 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 443 if((abs(abs(velocity.x)-2)<0.1) && (abs(velocity.z-0)<0.1)) 444 if(velocity.x<0){ 445 this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0))); 446 } 447 else{ 448 this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0))); 449 } 450 if((abs(abs(velocity.z)-2)<0.1) && (abs(velocity.x-0)<0.1)) 451 if(velocity.z<0){ 452 this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0))); 453 } 454 else{ 455 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); 456 } 457 this->getOrientation(); 458 456 459 } 457 460 } -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
r11958 r11978 68 68 int target_z = 0; 69 69 Vector3 velocity; 70 Vector3 oldvelocity = Vector3(2,0,0); 70 71 71 72 private: -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
r11976 r11978 58 58 XMLPortParam(PacmanHUDinfo, "showghoststatus", setGhoststatus, getGhoststatus, xmlelement, mode).defaultValues(false); 59 59 XMLPortParam(PacmanHUDinfo, "messageID", setMessageID, getMessageID, xmlelement, mode).defaultValues(0); 60 XMLPortParam(PacmanHUDinfo, "showgameover", setGameover, getGameover, xmlelement, mode).defaultValues(false); 61 XMLPortParam(PacmanHUDinfo, "showlive", setlive, getlive, xmlelement, mode).defaultValues(false); 60 62 61 63 … … 69 71 { 70 72 bool death = this->PacmanGame->isdead(); 71 if(death){ 72 bShowPoints_ = false; 73 bShowGhoststatus_ = false; 73 if(death && showgameover){ 74 74 const std::string& deathmessage = "Game Over"; 75 setTextSize(0. 4);75 setTextSize(0.08); 76 76 this->setCaption(deathmessage); 77 77 } 78 78 79 if(this->bShowPoints_ && !death) {79 if(this->bShowPoints_) { 80 80 const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->totallevelpoint); 81 setTextSize(0.0 4);81 setTextSize(0.03); 82 82 this->setCaption(points); 83 83 } 84 84 85 if(this->bShowGhoststatus_ && !death){ 86 const std::string& ghoststatus = "Do not get caught!"; 87 if(this->PacmanGame->afraid) const std::string& ghoststatus = "Catch the ghosts!"; 88 setTextSize(0.04); 89 this->setCaption(ghoststatus); 85 if(this->bShowGhoststatus_){ 86 if(this->PacmanGame->getAfraid()) { 87 const std::string& ghoststatus = "Catch the ghosts! \n " + multi_cast<std::string>(this->PacmanGame->getTimer()) + " seconds left"; 88 setTextSize(0.03); 89 this->setCaption(ghoststatus); 90 } 91 else{ 92 const std::string& ghoststatus = "Do not get caught!"; 93 setTextSize(0.03); 94 this->setCaption(ghoststatus); 95 } 90 96 } 97 98 if(this->showlive){ 99 const std::string& live = "Remaining lives: "+multi_cast<std::string>(this->PacmanGame->getLives()); 100 setTextSize(0.03); 101 this->setCaption(live); 102 } 103 104 if(death && !(this->showgameover)){ 105 setTextSize(0.0); 106 } 107 91 108 } 92 109 } -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
r11976 r11978 69 69 { return this->bShowGhoststatus_; } 70 70 71 inline void setGameover(bool value){ 72 this->showgameover = value; 73 } 74 inline int getGameover() const 75 { return this->showgameover; } 76 77 inline void setlive(bool value){ 78 this->showlive = value; 79 } 80 inline int getlive() const 81 { return this->showlive; } 82 83 71 84 private: 72 85 Pacman* PacmanGame; … … 74 87 bool bShowMessage_; 75 88 bool bShowGhoststatus_; 89 bool showgameover; 90 bool showlive; 76 91 int messageID; 77 92 }; -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
r11976 r11978 75 75 { 76 76 resetposition = this->getPosition(); 77 if((abs(resetposition.x - playerpos.x)<5) && (abs(resetposition. z - playerpos.z)<5)){77 if((abs(resetposition.x - playerpos.x)<5) && (abs(resetposition.y - playerpos.y)<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.