Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2019, 2:54:22 PM (5 years ago)
Author:
peterf
Message:

Improved formatting and added some comments to make the code more precise

File:
1 edited

Legend:

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

    r12338 r12357  
    1616        this->target_x=0;
    1717        this->target_z=15;
    18         this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);
     18        this->lastPlayerPassedPoint=Vector3(0,0,0);
    1919        this->pointInFrontOfPlayer=Vector3(0,0,0);
    2020         
     
    3434    {
    3535        SUPER(PacmanGhost, tick, dt);
    36 
    3736        this->actuelposition = this->getPosition();
    38         //std::cout<<this->actuelposition<<endl;
    39 
    4037
    4138        for(int u=0; u < 67; u++){//always check if player passed a point
     
    4542            }
    4643
    47         this->pointInFrontOfPlayer=frontPosition(); //getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
    48 
     44        this->pointInFrontOfPlayer=frontPosition();
    4945        Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
    5046       
     
    7470        }
    7571        else if(this->pointInFrontOfPlayer==Vector3(0,0,0)){
    76             std::cout<<"arheeuuuu"<<endl;
    7772
    7873            Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
    79 
    8074            setNewTargetGhost(getShortestPath(pinkPos, this->lastPlayerPassedPoint));
    81 
    8275
    8376        }
     
    8679            while(lockmove){};
    8780            lockmove = true;
    88 
    89             //this->pointInFrontOfPlayer=getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
    90            
    9181            nextMove(pinkPos, pointInFrontOfPlayer, lastPlayerPassedPoint);
    92 
    93 
    9482            lockmove=false;
    95 
    9683        }
    97 
    98 
    99 
    100 
    101 
    10284        }
    10385
     
    10890        Vector3 nextTarget;
    10991
    110         /*std::cout<<this->actuelposition<<endl;
    111         std::cout<<pinkPosP<<endl;
    112         std::cout<<playerPos<<endl;
    113         std::cout<<pointToAvoidP11<<endl;
    114         std::cout<<this->getPlayerPos()<<endl;*/
    115         std::cout<<playerPos<<endl;
    116         std::cout<<"kok"<<endl;
    117 
    11892        if(playerPos==pointToAvoidP11){ //SIGSEV if playerPos==pointToAvoidP11 otherwise
    11993            nextTarget = getShortestPath(pinkPosP, playerPos);
    12094        }
    121         /*else if(pinkPosP==pointToAvoidP11){
    122             nextTarget=getShortestPath(pinkPosP, playerPos);
    123         }*/
    124         else if((playerPos==Vector3(-70,10,-35))/*||(playerPos==Vector3(-20,10,-35))||(playerPos==Vector3(0,10,-35))*/){
    125             //nextTarget=pinkPosP;
     95        else if(playerPos==Vector3(-70,10,-35)){
     96           
    12697        nextTarget=getShortestPath(pinkPosP, Vector3(-70,10,-35));
    127         std::cout<<"ChaillyVillage"<<endl;
     98       
    12899        }
    129         /*else if((playerPos==Vector3(-70,10,-35))&&(pinkPosP==Vector3(-70,10,60))/*||(playerPos==Vector3(-20,10,-35))||(playerPos==Vector3(0,10,-35))){
    130             //nextTarget=pinkPosP;
    131         nextTarget=getShortestPath(pinkPosP, Vector3(-70,10,-35));
    132         std::cout<<"ChaillyVillage"<<endl;
    133         }*/
    134         else{
    135             //bugs here
    136             std::cout<<pinkPosP<<endl;
     100        else{   
     101       
    137102        nextTarget = getShortestPath(pinkPosP, playerPos, pointToAvoidP11);
    138103        }
    139         std::cout<<nextTarget<<endl;
     104       
    140105       setNewTargetGhost(nextTarget);
    141106    }
Note: See TracChangeset for help on using the changeset viewer.