- Timestamp:
- May 9, 2019, 2:54:22 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
r12338 r12357 1 1 #include "PacmanRed.h" 2 //#include "Pacman.h"3 2 4 3 #include "core/CoreIncludes.h" … … 16 15 this->target_x=0; 17 16 this->target_z=15; 18 this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);17 this->lastPlayerPassedPoint=Vector3(0,0,0); 19 18 this->isNearPlayer=false; 20 19 … … 31 30 } 32 31 33 /*void PacmanRed::setPlayerPos(Vector3 _playerPos)34 {35 this->playerPos = _playerPos;36 }*/37 38 39 32 void PacmanRed::tick(float dt) 40 33 { 41 //std::cout<<"LemanExpress5"<<endl;42 34 SUPER(PacmanGhost, tick, dt); 43 35 … … 45 37 46 38 for(int u=0; u < 67; u++){//always check if player passed a point 47 //if(possibleposition[u]!=Vector3(0,10,15)){39 48 40 if(jeanfindpos(this->getPlayerPos(), possibleposition[u])){ 49 //if(!findpos(possibleposition[u],Vector3(0,10,15))){41 50 42 this->lastPlayerPassedPoint=possibleposition[u]; 51 } 52 //} 53 //} 43 } 54 44 } 55 56 std::cout<<this->lastPlayerPassedPoint<<endl;57 std::cout<<this->pointInFrontOfPlayer<<endl;58 59 60 45 61 46 //Stop, if target arrived 62 47 if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){ 63 //std::cout<<"LemanExpress1"<<endl;48 64 49 this->ismoving = false; 65 50 } … … 67 52 //Move, if ghost hasn't arrived yet 68 53 if(this->ismoving){ 69 //std::cout<<"LemanExpress2"<<endl;54 70 55 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 71 56 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); … … 76 61 move(dt, actuelposition, velocity); 77 62 } 78 //std::cout<<"LemanExpress4"<<endl;63 79 64 } 80 65 else if(this->lastPlayerPassedPoint==Vector3(0,0,0)){ … … 89 74 //Check on which position the ghost has arrived and set new target 90 75 else{ 91 std::cout<<"LemanExpress3"<<endl;92 76 93 77 while(lockmove){}; … … 98 82 99 83 Vector3 redPos=Vector3(this->target_x, 10, this->target_z); 100 //nextMove(this->getPlayerPos(), redPos); 101 102 this->pointInFrontOfPlayer=frontPosition(); //getPointInFrontOfPacman(lastPlayerPassedPoint, directionV); 103 84 this->pointInFrontOfPlayer=frontPosition(); 104 85 105 86 if(!findpos(this->actuelposition, lastPlayerPassedPoint)){ 106 87 107 /*std::cout<<this->getPlayerPos()<<endl;108 std::cout<<this->lastPlayerPassedPoint<<endl;109 std::cout<<this->pointInFrontOfPlayer<<endl;110 std::cout<<this->actuelposition<<endl;*/111 88 nextMove(redPos, lastPlayerPassedPoint); 112 std::cout<<"hiuddi"<<endl;113 89 } 114 90 else if(findpos(this->actuelposition, lastPlayerPassedPoint)){// red pacman is at lastPlayerPassedPoint 115 91 116 /*std::cout<<"dhdidjop"<<endl; 117 std::cout<<this->getPlayerPos()<<endl; 118 std::cout<<this->lastPlayerPassedPoint<<endl; 119 std::cout<<this->pointInFrontOfPlayer<<endl; 120 std::cout<<this->actuelposition<<endl;*/ 121 122 //if(!findpos(pointInFrontOfPlayer, Vector3(0,10,15))){ 123 nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer); 124 //} 125 std::cout<<"ogslodm"<<endl; 92 nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer); 126 93 } 127 128 94 129 95 lockmove=false; //NEVER FORGET THIS ONE !!!!!!!
Note: See TracChangeset
for help on using the changeset viewer.