Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12323


Ignore:
Timestamp:
Apr 25, 2019, 2:45:27 PM (5 years ago)
Author:
peterf
Message:

continued brown

Location:
code/branches/3DPacman_FS19/src/modules/pacman
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc

    r12322 r12323  
    9292
    9393            Vector3 brownPos=Vector3(this->target_x, 10, this->target_z);
    94 
    95             if(absoluteDistance(this->lastPlayerPassedPoint, this->actuelposition)<50){
     94            std::cout<<brownPos<<endl;
     95
     96           
     97            if(this->isFleeing==true){
     98                if(findpos(brownPos, Vector3(-215,10,-195))){
     99                    this->isFleeing=false;
     100                    //Vector3 nextMoveP = getShortestPath(brownPos, this->lastPlayerPassedPoint);
     101                    //this->setNewTargetGhost(nextMoveP);
     102                }
     103                else{
     104                    Vector3 nextMoveP = getShortestPath(brownPos, Vector3(-215,10,-195));
     105                    this->setNewTargetGhost(nextMoveP);
     106                }
     107
     108            }
     109            else {
     110                    Vector3 arrayPlaNeig[4];
     111
     112                    findNeighboorPositions(this->lastPlayerPassedPoint, arrayPlaNeig, possibleposition);
     113                    if(isAdjacentToPlayerLastPastPoint(brownPos, arrayPlaNeig)){
     114                        this->isFleeing=true;
     115                    }
     116                    else{
     117                        Vector3 nextMove = getShortestPath(brownPos, this->lastPlayerPassedPoint);       
     118                        setNewTargetGhost(nextMove);
     119                    }
     120
     121            }
     122            std::cout<<this->isFleeing<<endl;
     123
     124
     125            /*if(absoluteDistance(this->lastPlayerPassedPoint, this->actuelposition)<50){
    96126                //no idea if 50 is large enough
    97127
     
    123153                std::cout<<"fleeing"<<endl;
    124154            }
    125         }
     155        }*/
    126156
    127157
     
    155185   
    156186        }
    157 
     187}
    158188
    159189
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc

    r12322 r12323  
    711711            else if(findpos(actuelposition,possibleposition[59])){
    712712                adjacentVertices[0]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
    713                 adjacentVertices[1]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
     713                adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[59]);
    714714                adjacentVertices[2]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);
    715715                          }
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc

    r12322 r12323  
    4545
    4646        for(int u=0; u < 67; u++){//always check if player passed a point
    47             if(jeanfindpos(this->getPlayerPos(), possibleposition[u])){
    48             this->lastPlayerPassedPoint=possibleposition[u];
    49                     }
     47            //if(possibleposition[u]!=Vector3(0,10,15)){
     48                if(jeanfindpos(this->getPlayerPos(), possibleposition[u])){
     49                    //if(!findpos(possibleposition[u],Vector3(0,10,15))){
     50                this->lastPlayerPassedPoint=possibleposition[u];
     51                            }
     52                        //}
     53                //}
    5054            }
    5155
     
    125129                std::cout<<this->actuelposition<<endl;*/
    126130
     131                //if(!findpos(pointInFrontOfPlayer, Vector3(0,10,15))){
    127132                nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer);
     133                    //}
    128134                std::cout<<"ogslodm"<<endl;
    129135            }
Note: See TracChangeset for help on using the changeset viewer.