Changeset 12321
- Timestamp:
- Apr 22, 2019, 3:09:22 PM (6 years ago)
- Location:
- code/branches/3DPacman_FS19/src/modules/pacman
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.cc
r12320 r12321 17 17 this->target_z=15; 18 18 this->lastPlayerPassedPoint=Vector3(70,10,-135); 19 20 this->isPatrolling = false; 19 21 20 22 } … … 67 69 lockmove = true; 68 70 71 Vector3 cyanPos=Vector3(this->target_x, 10, this->target_z); 69 72 73 if(this->isPatrolling==false){ 74 //we are not patrolling anymore, choose new patrol 70 75 71 Vector3 cyanPos=Vector3(this->target_x, 10, this->target_z); 76 77 this->nextPatrol(); 78 79 } 80 else if((this->isPatrolling==true)&&(cyanPos!=this->goalPatrol)){ 81 82 83 84 } 85 else if(cyanPos==this->goalPatrol){ 86 87 } 88 else if(cyanPos==this->startPatrol){ 89 90 } 91 92 72 93 73 94 … … 77 98 78 99 } 100 101 void PacmanCyan::nextPatrol(){ 102 103 104 int indexRand1=rand()%67; 105 while(indexRand1==44){ 106 //new try if index is that of the position in the middle 107 indexRand1=rand()%67; 108 } 109 110 int indexRand2=rand()%67; 111 while((indexRand2==44)||(indexRand2==indexRand1)){ 112 //new try if 2nd index is same as first one or is index 113 // of position in the middle 114 115 indexRand2=rand()%67; 116 } 117 118 119 120 121 this->startPatrol = possibleposition[indexRand1]; 122 this->goalPatrol = possibleposition[indexRand2]; 123 124 Vector3 nextMovement = getShortestPath(startPatrol, goalPatrol); 125 126 } 127 128 79 129 80 130 … … 88 138 } 89 139 140 struct PacmanCyan::PatrolPosition{ 141 //we need to check if PacmanCyan already passed the goal resp. start patrol point 142 143 public: 144 145 Vector3 position; 146 bool visitedPoint; 147 148 PatrolPosition(Vector3 positionP){ 149 this->position=positionP; 150 visitedPoint=false; 151 } 152 153 }; 154 90 155 91 156 } -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.h
r12320 r12321 20 20 void nextMove( Vector3 cyanPosP, Vector3 playerPos); 21 21 22 bool isPatrolling; 23 24 void nextPatrol(); 25 26 Vector3 startPatrol; 27 Vector3 goalPatrol; 28 29 struct PatrolPosition; 30 22 31 23 32
Note: See TracChangeset
for help on using the changeset viewer.