Changeset 11992 for code/branches/3DPacman_FS18/src
- Timestamp:
- May 24, 2018, 3:36:40 PM (7 years ago)
- Location:
- code/branches/3DPacman_FS18/src/modules/pacman
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc
r11984 r11992 247 247 bool Pacman::isdead(){ 248 248 return death; 249 } 250 //Getter 251 int Pacman::getTotalpoints(){ 252 return totallevelpoint; 249 253 } 250 254 … … 272 276 death = true; 273 277 274 //if (Highscore::exists())275 // Highscore::getInstance().storeScore("3DPacman", this->getPoints(), this->playerInfo_);276 277 278 deathtime = deathtime-dt; 278 279 -
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
r11979 r11992 21 21 * 22 22 * Author: 23 * Florian Zinggeler23 * Marc Dreher 24 24 * Co-authors: 25 25 * ... … … 40 40 #include "PacmanPointSphere.h" 41 41 #include "PacmanPointAfraid.h" 42 #include "Highscore.h"43 //#include "PlayerInfo.h"44 42 45 43 … … 73 71 virtual void tick(float dt) override; 74 72 73 PacmanGelb* getPlayer(); 74 int getPoints(); 75 bool getAfraid(); 76 int getTimer(); 77 int getLives(); 78 int getLevel(); 79 int getTotalpoints(); 80 bool isdead(); 81 82 private: 83 75 84 void levelUp(); 76 85 bool collis(Vector3 one, Vector3 other); … … 78 87 void posreset(); 79 88 void takePoint(PacmanPointSphere* taken); 80 PacmanGelb* getPlayer();81 int getPoints();82 89 void setAfraid(); 83 90 void setNormal(); 84 bool isdead();85 91 void dead(float dt); 86 bool getAfraid();87 int getTimer();88 int getLives();89 int getLevel();90 92 91 92 bool bEndGame; 93 bool bShowLevel; 94 int lives; 95 int multiplier; 96 float counter; 97 int pattern; 98 float lastPosition; 99 93 PacmanGelb* player; 100 94 Vector3 currentPosition; 101 PacmanGelb* player;95 Vector3 startposplayer = Vector3(0,10,150); 102 96 bool bcolli = false; 103 float timer = 0; 104 Vector3 startposplayer = Vector3(0,10,150); 97 105 98 int totallevelpoint; 106 //bool firstGame;99 107 100 bool afraid = false; 108 101 bool death = false; 109 102 float deathtime = 0; 110 111 private: 103 float timer = 0; 112 104 113 114 Timer endGameTimer;115 105 int level; 116 106 int point; 117 bool b_combo; 118 119 Timer enemySpawnTimer; 120 Timer comboTimer; 121 Timer showLevelTimer; 122 123 /* 124 std::string sDeathMessage; 125 const std::vector<std::string> DeathMessage7 = { 126 "You should really try that again", 127 "You can do better, can you?", 128 "Hey, maybe you get a participation award, that's good isn't it?", 129 "Congratulations, you get a medal, a wooden one", 130 "That was flappin bad!", 131 "Well, that was a waste of time", 132 "You suck!", 133 "Maybe try SuperOrxoBros. That game is not as hard.", 134 "Here's a tip: Try not to fly into these grey thingies.", 135 "We won't comment on that."}; 136 const std::vector<std::string> DeathMessage20 = { 137 "Getting better!", 138 "Training has paid off, huh?", 139 "Good average!", 140 "That was somehow enjoyable to watch", 141 "Flappin average", 142 "Getting closer to something", 143 "That wasn't crap, not bad", 144 "Surprisingly not bad."}; 145 */ 107 int lives; 146 108 147 109 }; -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
r11979 r11992 21 21 * 22 22 * Author: 23 * Oli Scheuss23 * Marc Dreher 24 24 * Co-authors: 25 * Damian 'Mozork' Frick25 * .. 26 26 * 27 27 */ … … 62 62 /** 63 63 @brief 64 Destructor. Destroys controller, if present.64 Destructor. Destroys ghost, if present. 65 65 */ 66 66 PacmanGhost::~PacmanGhost() … … 71 71 /** 72 72 @brief 73 Method for creating a AutonomousDronethrough XML.73 Method for creating a ghost through XML. 74 74 */ 75 75 void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode) … … 79 79 80 80 81 81 //All positions in the map, see documentation 82 82 Vector3 possibleposition[] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-4 83 83 Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9 … … 97 97 /** 98 98 @brief 99 Defines which actions the AutonomousDronehas to take in each tick.99 Defines which actions the ghost has to take in each tick. 100 100 @param dt 101 101 The length of the tick. … … 104 104 { 105 105 SUPER(PacmanGhost, tick, dt); 106 107 //setorientation108 106 109 107 this->actuelposition = this->getPosition(); … … 340 338 } 341 339 340 //Random choice of new target (not used in game, but useful) 342 341 void PacmanGhost::setnewTarget(int firstdec){ 343 342 … … 352 351 } 353 352 353 //Random choice of new target 354 354 void PacmanGhost::setnewTarget(int firstdec, int seconddec){ 355 355 decision = rand()%2; … … 369 369 } 370 370 371 //Random choice of new target 371 372 void PacmanGhost::setnewTarget(int firstdec, int seconddec, int thirddec){ 372 373 … … 392 393 } 393 394 395 //Random choice of new target 394 396 void PacmanGhost::setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec){ 395 397 … … 420 422 } 421 423 424 //Change this with other ghost 422 425 void PacmanGhost::changewith(PacmanGhost* otherghost){ 423 426 424 427 while(lockmove){}; 425 lockmove = true; 428 lockmove = true; //Prevent change of target while ghost is changed 426 429 427 430 otherghost->setPosition(this->getPosition()); 428 431 this->setPosition(0,-20,0); 429 otherghost->target_x = this->target_x; //Probleme bei parallelen Porzessen432 otherghost->target_x = this->target_x; 430 433 otherghost->target_z = this->target_z; 431 434 otherghost->ismoving = this->ismoving; … … 437 440 } 438 441 439 442 //Move ghost with rotation 440 443 void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){ 441 444 if(!dontmove){ 442 445 this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt)); 446 447 //Rotate ghost in the direction of movement 443 448 if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)) 444 449 if(velocity.x<0){ … … 455 460 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); 456 461 } 457 this->getOrientation();458 462 459 463 } 460 464 } 461 465 466 //Check if there is a collision 462 467 bool PacmanGhost::findpos(Vector3 one, Vector3 other){ 463 468 if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true; … … 465 470 } 466 471 472 //Change ability to move 467 473 void PacmanGhost::changemovability(){ 468 474 if(dontmove){ … … 473 479 } 474 480 481 //ResetGhost 475 482 void PacmanGhost::resetGhost(){ 476 483 … … 484 491 } 485 492 493 //Increase speed of ghosts 486 494 void PacmanGhost::levelupvelo(){ 487 495 speed ++; -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
r11979 r11992 21 21 * 22 22 * Author: 23 * Oli Scheuss23 * Marc Dreher 24 24 * Co-authors: 25 * Damian 'Mozork' Frick25 * .. 26 26 * 27 27 */ … … 35 35 36 36 #include "worldentities/ControllableEntity.h" 37 //Test 37 38 38 namespace orxonox { 39 39 … … 51 51 void resetGhost(); 52 52 53 void setnewTarget(int firstdec);54 void setnewTarget(int firstdec, int seconddec);55 void setnewTarget(int firstdec, int seconddec, int thirddec);56 void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec);57 53 void changewith(PacmanGhost* otherghost); 58 54 void levelupvelo(); … … 61 57 void changemovability(); 62 58 bool dontmove = false; 63 bool lockmove = false; 59 60 private: 61 int decision = 0; 62 Vector3 resetposition = Vector3(0,10,15); 63 Vector3 velocity; 64 int speed = 20; 64 65 65 66 Vector3 actuelposition; … … 67 68 int target_x = 0; 68 69 int target_z = 0; 69 Vector3 velocity; 70 Vector3 oldvelocity = Vector3(2,0,0); 71 int speed = 20; 70 bool lockmove = false; 72 71 73 private: 74 int decision = 0; //Gives the random which way information to the ghost. 75 Vector3 resetposition = Vector3(0,10,15); 72 void setnewTarget(int firstdec); 73 void setnewTarget(int firstdec, int seconddec); 74 void setnewTarget(int firstdec, int seconddec, int thirddec); 75 void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec); 76 76 }; 77 77 -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
r11979 r11992 21 21 * 22 22 * Author: 23 * Leo Merholz 24 * Pascal Schärli 25 * 23 * Marc Dreher 24 26 25 * Co-authors: 27 26 * ... … … 79 78 80 79 if(this->bShowPoints_) { 81 const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame-> totallevelpoint);80 const std::string& points = "Collected points: "+multi_cast<std::string>(this->PacmanGame->getPoints()) + " of " + multi_cast<std::string>(this->PacmanGame->getTotalpoints()); 82 81 setTextSize(0.03); 83 82 this->setCaption(points); -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
r11979 r11992 21 21 * 22 22 * Author: 23 * Florian Zinggeler23 * Marc Dreher 24 24 * 25 25 */ -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
r11979 r11992 21 21 * 22 22 * Author: 23 * Oli Scheuss23 * Marc Dreher 24 24 * Co-authors: 25 * Damian 'Mozork' Frick25 * 26 26 * 27 27 */ … … 59 59 /** 60 60 @brief 61 Method for creating a AutonomousDronethrough XML.61 Method for creating a PacmanPointAfraid through XML. 62 62 */ 63 63 void PacmanPointAfraid::XMLPort(Element& xmlelement, XMLPort::Mode mode) … … 72 72 } 73 73 74 //Check for collision 74 75 bool PacmanPointAfraid::taken(Vector3 playerpos) 75 76 { … … 83 84 } 84 85 85 86 //Reset position 86 87 void PacmanPointAfraid::resetPacmanPointAfraid(){ 87 88 resetposition = this->getPosition(); -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.h
r11956 r11992 21 21 * 22 22 * Author: 23 * Oli Scheuss23 * Marc Dreher 24 24 * Co-authors: 25 * Damian 'Mozork' Frick25 * 26 26 * 27 27 */ … … 44 44 virtual ~PacmanPointAfraid(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.47 virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 virtual void tick(float dt); 48 48 49 49 bool taken(Vector3 playerpos); -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
r11979 r11992 21 21 * 22 22 * Author: 23 * Oli Scheuss23 * Marc Dreher 24 24 * Co-authors: 25 * Damian 'Mozork' Frick25 * 26 26 * 27 27 */ … … 72 72 } 73 73 74 //Check for collision 74 75 bool PacmanPointSphere::taken(Vector3 playerpos) 75 76 { … … 83 84 } 84 85 85 86 //Reset position 86 87 void PacmanPointSphere::resetPacmanPointSphere(){ 87 88 resetposition = this->getPosition(); -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.h
r11915 r11992 21 21 * 22 22 * Author: 23 * Oli Scheuss23 * Marc Dreher 24 24 * Co-authors: 25 * Damian 'Mozork' Frick25 * 26 26 * 27 27 */ -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPrereqs.h
r11898 r11992 21 21 * 22 22 * Author: 23 * Florian Zinggeler23 * Marc Dreher 24 24 * Co-authors: 25 25 * ...
Note: See TracChangeset
for help on using the changeset viewer.