Changeset 11979 for code/branches/3DPacman_FS18/src/modules/pacman
- Timestamp:
- May 22, 2018, 1:04:40 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
r11978 r11979 64 64 } 65 65 this->posreset(); 66 67 totallevelpoint = ObjectList<PacmanPointSphere>().size() + totallevelpoint; 68 level++; 66 69 } 67 70 … … 124 127 } 125 128 126 } 127 128 129 129 } 130 130 131 131 } … … 193 193 } 194 194 195 int Pacman::getLevel(){ 196 return level; 197 } 198 195 199 void Pacman::posreset(){ 196 200 for(int i = 0; i<4; ++i){ … … 202 206 void Pacman::takePoint(PacmanPointSphere* taken){ 203 207 ++point; 204 if(point == totallevelpoint) this->levelUp(); 208 if(point == totallevelpoint){ 209 this->levelUp(); 210 return; 211 } 205 212 Vector3 postaken = taken->getPosition(); 206 213 postaken.y = -50; -
code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h
r11978 r11979 87 87 int getTimer(); 88 88 int getLives(); 89 int getLevel(); 89 90 90 91 -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h
r11978 r11979 59 59 60 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)));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 63 }; 64 64 virtual void rotatePitch(const Vector2& value) override{}; -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc
r11978 r11979 117 117 if(this->ismoving){ 118 118 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 119 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z) *2);119 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); 120 120 move(dt, actuelposition, velocity); 121 121 } 122 122 if(!(abs(this->actuelposition.x-target_x)<0.5)){ 123 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x) *2,0,0);123 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0); 124 124 move(dt, actuelposition, velocity); 125 125 } … … 440 440 void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){ 441 441 if(!dontmove){ 442 this->setPosition(Vector3(actuelposition.x+ 20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));443 if((abs(abs(velocity.x)- 2)<0.1) && (abs(velocity.z-0)<0.1))442 this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt)); 443 if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)) 444 444 if(velocity.x<0){ 445 445 this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0))); … … 448 448 this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0))); 449 449 } 450 if((abs(abs(velocity.z)- 2)<0.1) && (abs(velocity.x-0)<0.1))450 if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1)) 451 451 if(velocity.z<0){ 452 452 this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0))); … … 485 485 486 486 void PacmanGhost::levelupvelo(){ 487 velocity.x = velocity.x + 2; 488 velocity.y = velocity.y + 2; 489 velocity.z = velocity.z + 2; 487 speed ++; 490 488 } 491 489 } -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h
r11978 r11979 69 69 Vector3 velocity; 70 70 Vector3 oldvelocity = Vector3(2,0,0); 71 int speed = 20; 71 72 72 73 private: -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc
r11978 r11979 60 60 XMLPortParam(PacmanHUDinfo, "showgameover", setGameover, getGameover, xmlelement, mode).defaultValues(false); 61 61 XMLPortParam(PacmanHUDinfo, "showlive", setlive, getlive, xmlelement, mode).defaultValues(false); 62 XMLPortParam(PacmanHUDinfo, "showlevel", setlevel, getlevel, xmlelement, mode).defaultValues(false); 62 63 63 64 … … 102 103 } 103 104 105 if(this->showlevel){ 106 const std::string& live = "Level: "+multi_cast<std::string>(this->PacmanGame->getLevel()); 107 setTextSize(0.03); 108 this->setCaption(live); 109 } 110 111 104 112 if(death && !(this->showgameover)){ 105 113 setTextSize(0.0); -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h
r11978 r11979 81 81 { return this->showlive; } 82 82 83 inline void setlevel(bool value){ 84 this->showlevel = value; 85 } 86 inline int getlevel() const 87 { return this->showlevel; } 88 83 89 84 90 private: … … 89 95 bool showgameover; 90 96 bool showlive; 97 bool showlevel; 91 98 int messageID; 92 99 }; -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc
r11978 r11979 85 85 86 86 void PacmanPointAfraid::resetPacmanPointAfraid(){ 87 resetposition = this->getPosition(); 88 resetposition.y = 10; 87 89 this->setPosition(resetposition); 88 90 } -
code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc
r11956 r11979 85 85 86 86 void PacmanPointSphere::resetPacmanPointSphere(){ 87 resetposition = this->getPosition(); 88 resetposition.y = 10; 87 89 this->setPosition(resetposition); 88 90 }
Note: See TracChangeset
for help on using the changeset viewer.