- Timestamp:
- Apr 21, 2019, 11:30:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
r12318 r12319 36 36 }*/ 37 37 38 bool PacmanRed::jeanfindpos(Vector3 one, Vector3 other){39 if((abs(one.x - other.x)<15) && (abs(one.y - other.y)<15) && (abs(one.z - other.z)<15)) return true;40 return false;41 }42 38 43 39 void PacmanRed::tick(float dt) 44 40 { 45 std::cout<<"LemanExpress5"<<endl;41 //std::cout<<"LemanExpress5"<<endl; 46 42 SUPER(PacmanGhost, tick, dt); 47 43 … … 69 65 //Stop, if target arrived 70 66 if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){ 71 std::cout<<"LemanExpress1"<<endl;67 //std::cout<<"LemanExpress1"<<endl; 72 68 this->ismoving = false; 73 69 } … … 75 71 //Move, if ghost hasn't arrived yet 76 72 if(this->ismoving){ 77 std::cout<<"LemanExpress2"<<endl;73 //std::cout<<"LemanExpress2"<<endl; 78 74 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 79 75 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); … … 84 80 move(dt, actuelposition, velocity); 85 81 } 86 std::cout<<"LemanExpress4"<<endl;82 //std::cout<<"LemanExpress4"<<endl; 87 83 } 88 84 … … 106 102 if(!findpos(this->actuelposition, lastPlayerPassedPoint)){ 107 103 108 std::cout<<this->getPlayerPos()<<endl;104 /*std::cout<<this->getPlayerPos()<<endl; 109 105 std::cout<<this->lastPlayerPassedPoint<<endl; 110 106 std::cout<<this->pointInFrontOfPlayer<<endl; 111 std::cout<<this->actuelposition<<endl; 107 std::cout<<this->actuelposition<<endl;*/ 112 108 nextMove(redPos, lastPlayerPassedPoint); 113 109 std::cout<<"hiuddi"<<endl; … … 115 111 else if(findpos(this->actuelposition, lastPlayerPassedPoint)){// red pacman is at lastPlayerPassedPoint 116 112 117 std::cout<<"dhdidjop"<<endl;113 /*std::cout<<"dhdidjop"<<endl; 118 114 std::cout<<this->getPlayerPos()<<endl; 119 115 std::cout<<this->lastPlayerPassedPoint<<endl; 120 116 std::cout<<this->pointInFrontOfPlayer<<endl; 121 std::cout<<this->actuelposition<<endl; 117 std::cout<<this->actuelposition<<endl;*/ 122 118 123 119 nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer); … … 132 128 133 129 134 void PacmanRed::setNewTargetRed(Vector3 goalToGo){135 136 this->target_x = goalToGo.x;137 this->target_z = goalToGo.z;138 this->ismoving = true;139 }140 141 142 130 void PacmanRed::nextMove( Vector3 redPosP, Vector3 playerPos){ 143 131 … … 146 134 nextTarget = getShortestPath(redPosP, playerPos); 147 135 148 setNewTarget Red(nextTarget);136 setNewTargetGhost(nextTarget); 149 137 } 150 138
Note: See TracChangeset
for help on using the changeset viewer.