Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2019, 11:30:41 PM (6 years ago)
Author:
peterf
Message:

PacmanPink implementation, but lots of SIGSEGV

File:
1 edited

Legend:

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

    r12318 r12319  
    3636    }*/
    3737
    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         }
    4238
    4339    void PacmanRed::tick(float dt)
    4440    {
    45         std::cout<<"LemanExpress5"<<endl;
     41        //std::cout<<"LemanExpress5"<<endl;
    4642        SUPER(PacmanGhost, tick, dt);
    4743
     
    6965        //Stop, if target arrived
    7066        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;
    7268                 this->ismoving = false;
    7369        }
     
    7571        //Move, if ghost hasn't arrived yet
    7672        if(this->ismoving){
    77             std::cout<<"LemanExpress2"<<endl;
     73            //std::cout<<"LemanExpress2"<<endl;
    7874            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
    7975                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
     
    8480                move(dt, actuelposition, velocity);
    8581            }
    86             std::cout<<"LemanExpress4"<<endl;
     82            //std::cout<<"LemanExpress4"<<endl;
    8783        }
    8884
     
    106102            if(!findpos(this->actuelposition, lastPlayerPassedPoint)){
    107103               
    108                 std::cout<<this->getPlayerPos()<<endl;
     104                /*std::cout<<this->getPlayerPos()<<endl;
    109105                std::cout<<this->lastPlayerPassedPoint<<endl;
    110106                std::cout<<this->pointInFrontOfPlayer<<endl;
    111                 std::cout<<this->actuelposition<<endl;
     107                std::cout<<this->actuelposition<<endl;*/
    112108            nextMove(redPos, lastPlayerPassedPoint);
    113109            std::cout<<"hiuddi"<<endl;
     
    115111            else if(findpos(this->actuelposition, lastPlayerPassedPoint)){// red pacman is at lastPlayerPassedPoint
    116112
    117                 std::cout<<"dhdidjop"<<endl;
     113                /*std::cout<<"dhdidjop"<<endl;
    118114                std::cout<<this->getPlayerPos()<<endl;
    119115                std::cout<<this->lastPlayerPassedPoint<<endl;
    120116                std::cout<<this->pointInFrontOfPlayer<<endl;
    121                 std::cout<<this->actuelposition<<endl;
     117                std::cout<<this->actuelposition<<endl;*/
    122118
    123119                nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer);
     
    132128
    133129
    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 
    142130        void PacmanRed::nextMove( Vector3 redPosP, Vector3 playerPos){
    143131       
     
    146134           nextTarget = getShortestPath(redPosP, playerPos);
    147135       
    148            setNewTargetRed(nextTarget);
     136           setNewTargetGhost(nextTarget);
    149137        }
    150138
Note: See TracChangeset for help on using the changeset viewer.