Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12317 for code


Ignore:
Timestamp:
Apr 20, 2019, 6:29:44 PM (5 years ago)
Author:
peterf
Message:

Red Pacman seems to work even better

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

Legend:

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

    r12316 r12317  
    729729
    730730
     731
     732
     733    //functions taken from PacmanPink
     734
     735
     736
     737
     738
     739    Vector3 PacmanGhost::diffVector (Vector3 start, Vector3 goal){
     740
     741        Vector3 result;
     742        result.x=goal.x-start.x;
     743        result.z=goal.z-start.z;
     744        return result;
     745    }
     746
     747    int PacmanGhost::findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos){
     748        //return 0 for south, 1 for west, 2 for north, 3 for east
     749
     750        Vector3 difference = diffVector(playerPosBefore, playerPos);
     751
     752
     753        if((difference.z < 0)&&(difference.z>difference.x)){ //move south
     754
     755            return 0;
     756        }
     757        else if((difference.z>0)&&(difference.z>difference.x)){ //mouve north
     758
     759            return 2;
     760        }
     761        else if((difference.x < 0)&&(difference.x > difference.z )){//move west
     762
     763            return 1;
     764        }
     765
     766        else if((difference.x>0)&&(difference.x>difference.z)){ //move east
     767            return 3;
     768
     769        }
     770
     771        else { //default move west Can still be changed
     772
     773        return 1;
     774            }
     775       
     776        }
     777
     778    Vector3 PacmanGhost::getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE){
     779        //return the Vector3 point that Pinky should target to
     780        //be in front of pacman
     781
     782        Vector3 listOfNeighboors[4];
     783        //first element is south, 2nd west, 3d north, 4th east
     784
     785            if(findpos(pacLasVisPos,possibleposition[0])){
     786                //no south neighbor
     787                listOfNeighboors[1]=possibleposition[19]; // west neighbor
     788                listOfNeighboors[2]=possibleposition[17]; //north
     789                listOfNeighboors[3]=possibleposition[1]; //east
     790                return listOfNeighboors[indexForSWNE];
     791            }
     792            else if(findpos(pacLasVisPos,possibleposition[1])){
     793                listOfNeighboors[1]=possibleposition[0]; // west neighbor
     794                listOfNeighboors[2]=possibleposition[2]; //north
     795                return listOfNeighboors[indexForSWNE];
     796            }
     797            else if(findpos(pacLasVisPos,possibleposition[2])){
     798                listOfNeighboors[0]=possibleposition[1];  //south
     799                listOfNeighboors[1]=possibleposition[3]; //west
     800                return listOfNeighboors[indexForSWNE];
     801            }
     802            else if(findpos(pacLasVisPos,possibleposition[3])){
     803                listOfNeighboors[1]=possibleposition[4]; //west
     804                listOfNeighboors[2]=possibleposition[5]; //north
     805                listOfNeighboors[3]=possibleposition[2]; //east
     806                return listOfNeighboors[indexForSWNE];
     807            }
     808            else if(findpos(pacLasVisPos,possibleposition[4])){
     809                listOfNeighboors[2]=possibleposition[6]; //north
     810                listOfNeighboors[3]=possibleposition[3]; //east
     811                return listOfNeighboors[indexForSWNE];
     812            }
     813            else if(findpos(pacLasVisPos,possibleposition[5])){
     814                listOfNeighboors[0]=possibleposition[3]; //south
     815                listOfNeighboors[3]=possibleposition[7]; //east
     816                return listOfNeighboors[indexForSWNE];
     817            }
     818            else if(findpos(pacLasVisPos,possibleposition[6])){
     819                listOfNeighboors[0]=possibleposition[4]; //south
     820                listOfNeighboors[1]=possibleposition[26]; //west
     821                listOfNeighboors[2]=possibleposition[9]; //north
     822                return listOfNeighboors[indexForSWNE];
     823            }
     824            else if(findpos(pacLasVisPos,possibleposition[7])){
     825                listOfNeighboors[1]=possibleposition[5]; //west
     826                listOfNeighboors[2]=possibleposition[8]; //north
     827                return listOfNeighboors[indexForSWNE];
     828            }
     829            else if(findpos(pacLasVisPos,possibleposition[8])){
     830                listOfNeighboors[0]=possibleposition[7]; //south
     831                listOfNeighboors[1]=possibleposition[9]; //west
     832                return listOfNeighboors[indexForSWNE];
     833            }
     834            else if(findpos(pacLasVisPos,possibleposition[9])){
     835                listOfNeighboors[0]=possibleposition[6]; //south
     836                listOfNeighboors[1]=possibleposition[38]; //west
     837                listOfNeighboors[2]=possibleposition[10]; //north
     838                listOfNeighboors[3]=possibleposition[8]; //east
     839                return listOfNeighboors[indexForSWNE];
     840            }
     841            else if(findpos(pacLasVisPos,possibleposition[10])){
     842                listOfNeighboors[0]=possibleposition[9]; //south
     843                listOfNeighboors[1]=possibleposition[45]; //west
     844                listOfNeighboors[2]=possibleposition[11]; //north
     845                return listOfNeighboors[indexForSWNE];
     846            }
     847            else if(findpos(pacLasVisPos,possibleposition[11])){
     848                listOfNeighboors[0]=possibleposition[10]; //south
     849                listOfNeighboors[2]=possibleposition[13]; //north
     850                listOfNeighboors[3]=possibleposition[12]; //east
     851                return listOfNeighboors[indexForSWNE];
     852            }
     853            else if(findpos(pacLasVisPos,possibleposition[12])){
     854                listOfNeighboors[1]=possibleposition[11]; //west
     855                listOfNeighboors[2]=possibleposition[14]; //north
     856                return listOfNeighboors[indexForSWNE];
     857            }
     858            else if(findpos(pacLasVisPos,possibleposition[13])){
     859                listOfNeighboors[0]=possibleposition[11]; //south
     860                listOfNeighboors[1]=possibleposition[61]; //west
     861                listOfNeighboors[2]=possibleposition[16]; //north
     862                listOfNeighboors[3]=possibleposition[14]; //east
     863                return listOfNeighboors[indexForSWNE];
     864            }
     865            else if(findpos(pacLasVisPos,possibleposition[14])){
     866                listOfNeighboors[0]=possibleposition[12]; //south
     867                listOfNeighboors[1]=possibleposition[13]; //west
     868                listOfNeighboors[2]=possibleposition[15]; //north
     869                return listOfNeighboors[indexForSWNE];
     870            }
     871            else if(findpos(pacLasVisPos,possibleposition[15])){
     872                listOfNeighboors[0]=possibleposition[14]; //south
     873                listOfNeighboors[1]=possibleposition[16]; //west
     874                return listOfNeighboors[indexForSWNE];
     875            }
     876            else if(findpos(pacLasVisPos,possibleposition[16])){
     877                listOfNeighboors[0]=possibleposition[13]; //south
     878                listOfNeighboors[1]=possibleposition[62]; //west
     879                listOfNeighboors[2]=possibleposition[15]; //north
     880                return listOfNeighboors[indexForSWNE];
     881            }
     882            else if(findpos(pacLasVisPos,possibleposition[17])){
     883                listOfNeighboors[0]=possibleposition[0]; //south
     884                listOfNeighboors[3]=possibleposition[25]; //east
     885                return listOfNeighboors[indexForSWNE];
     886            }
     887            else if(findpos(pacLasVisPos,possibleposition[18])){
     888                listOfNeighboors[0]=possibleposition[19]; //south
     889                listOfNeighboors[1]=possibleposition[24]; //west
     890                return listOfNeighboors[indexForSWNE];
     891            }
     892            else if(findpos(pacLasVisPos,possibleposition[19])){
     893                listOfNeighboors[1]=possibleposition[20]; //west
     894                listOfNeighboors[2]=possibleposition[18]; //north
     895                listOfNeighboors[3]=possibleposition[0]; //east
     896                return listOfNeighboors[indexForSWNE];
     897            }
     898            else if(findpos(pacLasVisPos,possibleposition[20])){
     899                listOfNeighboors[2]=possibleposition[21]; //north
     900                listOfNeighboors[3]=possibleposition[19]; //east
     901                return listOfNeighboors[indexForSWNE];
     902            }
     903            else if(findpos(pacLasVisPos,possibleposition[21])){
     904                listOfNeighboors[0]=possibleposition[20]; //south
     905                listOfNeighboors[3]=possibleposition[22]; //east
     906                return listOfNeighboors[indexForSWNE];
     907            }
     908            else if(findpos(pacLasVisPos,possibleposition[22])){
     909                listOfNeighboors[1]=possibleposition[21]; //west
     910                listOfNeighboors[2]=possibleposition[31]; //north
     911                listOfNeighboors[3]=possibleposition[23]; //east
     912                return listOfNeighboors[indexForSWNE];
     913            }
     914            else if(findpos(pacLasVisPos,possibleposition[23])){
     915                listOfNeighboors[1]=possibleposition[22]; //west
     916                listOfNeighboors[2]=possibleposition[30]; //north
     917                return listOfNeighboors[indexForSWNE];
     918            }
     919            else if(findpos(pacLasVisPos,possibleposition[24])){
     920                listOfNeighboors[2]=possibleposition[29]; //north
     921                listOfNeighboors[3]=possibleposition[18]; //east
     922                return listOfNeighboors[indexForSWNE];
     923            }
     924            else if(findpos(pacLasVisPos,possibleposition[25])){
     925                listOfNeighboors[1]=possibleposition[17]; //west
     926                listOfNeighboors[2]=possibleposition[26]; //north
     927                return listOfNeighboors[indexForSWNE];
     928            }
     929            else if(findpos(pacLasVisPos,possibleposition[26])){
     930                listOfNeighboors[0]=possibleposition[25]; //south
     931                listOfNeighboors[1]=possibleposition[27]; //west
     932                listOfNeighboors[3]=possibleposition[6]; //east
     933                return listOfNeighboors[indexForSWNE];
     934            }
     935            else if(findpos(pacLasVisPos,possibleposition[27])){
     936                listOfNeighboors[1]=possibleposition[28]; //west
     937                listOfNeighboors[2]=possibleposition[37]; //north
     938                listOfNeighboors[3]=possibleposition[26]; //east
     939                return listOfNeighboors[indexForSWNE];
     940            }
     941            else if(findpos(pacLasVisPos,possibleposition[28])){
     942                listOfNeighboors[1]=possibleposition[29]; //west
     943                listOfNeighboors[2]=possibleposition[36]; //north
     944                listOfNeighboors[3]=possibleposition[27]; //east
     945                return listOfNeighboors[indexForSWNE];
     946            }
     947            else if(findpos(pacLasVisPos,possibleposition[29])){
     948                listOfNeighboors[0]=possibleposition[24]; //south
     949                listOfNeighboors[1]=possibleposition[30]; //west
     950                listOfNeighboors[3]=possibleposition[28]; //east
     951                return listOfNeighboors[indexForSWNE];
     952            }
     953            else if(findpos(pacLasVisPos,possibleposition[30])){
     954                listOfNeighboors[0]=possibleposition[23]; //south
     955                listOfNeighboors[2]=possibleposition[34]; //north
     956                listOfNeighboors[3]=possibleposition[29]; //east
     957                return listOfNeighboors[indexForSWNE];
     958            }
     959            else if(findpos(pacLasVisPos,possibleposition[31])){
     960                listOfNeighboors[0]=possibleposition[22]; //south
     961                listOfNeighboors[1]=possibleposition[32]; //west
     962                return listOfNeighboors[indexForSWNE];
     963            }
     964            else if(findpos(pacLasVisPos,possibleposition[32])){
     965                listOfNeighboors[2]=possibleposition[33]; //north
     966                listOfNeighboors[3]=possibleposition[31]; //east
     967                return listOfNeighboors[indexForSWNE];
     968            }
     969            else if(findpos(pacLasVisPos,possibleposition[33])){
     970                listOfNeighboors[0]=possibleposition[32]; //south
     971                listOfNeighboors[3]=possibleposition[34]; //east
     972                return listOfNeighboors[indexForSWNE];
     973            }
     974            else if(findpos(pacLasVisPos,possibleposition[34])){
     975                listOfNeighboors[0]=possibleposition[30]; //south
     976                listOfNeighboors[1]=possibleposition[33]; //west
     977                listOfNeighboors[2]=possibleposition[92]; //north
     978                listOfNeighboors[3]=possibleposition[35]; //east
     979                return listOfNeighboors[indexForSWNE];
     980            }
     981            else if(findpos(pacLasVisPos,possibleposition[35])){
     982                listOfNeighboors[1]=possibleposition[34]; //west
     983                listOfNeighboors[2]=possibleposition[91]; //north
     984                listOfNeighboors[3]=possibleposition[36]; //east
     985                return listOfNeighboors[indexForSWNE];
     986            }
     987            else if(findpos(pacLasVisPos,possibleposition[36])){
     988                listOfNeighboors[0]=possibleposition[28]; //south
     989                listOfNeighboors[1]=possibleposition[35]; //west
     990                return listOfNeighboors[indexForSWNE];
     991            }
     992            else if(findpos(pacLasVisPos,possibleposition[37])){
     993                listOfNeighboors[0]=possibleposition[27]; //south
     994                listOfNeighboors[3]=possibleposition[38]; //east
     995                return listOfNeighboors[indexForSWNE];
     996            }
     997            else if(findpos(pacLasVisPos,possibleposition[38])){
     998                listOfNeighboors[1]=possibleposition[37]; //west
     999                listOfNeighboors[2]=possibleposition[39]; //north
     1000                listOfNeighboors[3]=possibleposition[9]; //east
     1001                return listOfNeighboors[indexForSWNE];
     1002            }
     1003            else if(findpos(pacLasVisPos,possibleposition[39])){
     1004                listOfNeighboors[0]=possibleposition[38]; //south
     1005                listOfNeighboors[1]=possibleposition[40]; //west
     1006                listOfNeighboors[2]=possibleposition[45]; //north
     1007                return listOfNeighboors[indexForSWNE];
     1008            }
     1009            else if(findpos(pacLasVisPos,possibleposition[40])){
     1010                listOfNeighboors[1]=possibleposition[41]; //west
     1011                //Not return in center
     1012                listOfNeighboors[3]=possibleposition[39]; //east
     1013                return listOfNeighboors[indexForSWNE];
     1014            }
     1015            else if(findpos(pacLasVisPos,possibleposition[41])){
     1016                listOfNeighboors[0]=possibleposition[35]; //south
     1017                listOfNeighboors[2]=possibleposition[43]; //north
     1018                listOfNeighboors[3]=possibleposition[40]; //east
     1019                return listOfNeighboors[indexForSWNE];
     1020            }
     1021            else if(findpos(pacLasVisPos,possibleposition[42])){
     1022                listOfNeighboors[0]=possibleposition[39]; //south
     1023                listOfNeighboors[2]=possibleposition[59]; //north
     1024                listOfNeighboors[3]=possibleposition[43]; //east
     1025                return listOfNeighboors[indexForSWNE];
     1026            }
     1027            else if(findpos(pacLasVisPos,possibleposition[43])){
     1028                listOfNeighboors[0]=possibleposition[41]; //south
     1029                listOfNeighboors[1]=possibleposition[42]; //west
     1030                listOfNeighboors[2]=possibleposition[46]; //north
     1031                return listOfNeighboors[indexForSWNE];
     1032            }
     1033            else if(findpos(pacLasVisPos,possibleposition[44])){
     1034                listOfNeighboors[0]=possibleposition[40]; //south
     1035                listOfNeighboors[2]=possibleposition[66]; //north
     1036                return listOfNeighboors[indexForSWNE];
     1037            }
     1038            else if(findpos(pacLasVisPos,possibleposition[45])){
     1039                listOfNeighboors[0]=possibleposition[39]; //south
     1040                listOfNeighboors[2]=possibleposition[49]; //north
     1041                listOfNeighboors[3]=possibleposition[10]; //east
     1042                return listOfNeighboors[indexForSWNE];
     1043            }
     1044            else if(findpos(pacLasVisPos,possibleposition[46])){
     1045                listOfNeighboors[0]=possibleposition[43]; //south
     1046                listOfNeighboors[3]=possibleposition[47]; //east
     1047                return listOfNeighboors[indexForSWNE];
     1048            }
     1049            else if(findpos(pacLasVisPos,possibleposition[47])){
     1050                listOfNeighboors[1]=possibleposition[46]; //west
     1051                listOfNeighboors[2]=possibleposition[52]; //north
     1052                listOfNeighboors[3]=possibleposition[66]; //east
     1053                return listOfNeighboors[indexForSWNE];
     1054            }
     1055            else if(findpos(pacLasVisPos,possibleposition[48])){
     1056                listOfNeighboors[1]=possibleposition[66]; //west
     1057                listOfNeighboors[2]=possibleposition[51]; //north
     1058                listOfNeighboors[3]=possibleposition[49]; //east
     1059                return listOfNeighboors[indexForSWNE];
     1060            }
     1061            else if(findpos(pacLasVisPos,possibleposition[49])){
     1062                listOfNeighboors[0]=possibleposition[45]; //south
     1063                listOfNeighboors[1]=possibleposition[48]; //west
     1064                return listOfNeighboors[indexForSWNE];
     1065            }
     1066            else if(findpos(pacLasVisPos,possibleposition[50])){
     1067                listOfNeighboors[1]=possibleposition[51]; //west
     1068                listOfNeighboors[2]=possibleposition[61]; //north
     1069                return listOfNeighboors[indexForSWNE];
     1070            }
     1071            else if(findpos(pacLasVisPos,possibleposition[51])){
     1072                listOfNeighboors[0]=possibleposition[48]; //south
     1073                listOfNeighboors[3]=possibleposition[50]; //east
     1074                return listOfNeighboors[indexForSWNE];
     1075            }
     1076            else if(findpos(pacLasVisPos,possibleposition[52])){
     1077                listOfNeighboors[0]=possibleposition[47]; //south
     1078                listOfNeighboors[1]=possibleposition[53]; //west
     1079                return listOfNeighboors[indexForSWNE];
     1080            }
     1081            else if(findpos(pacLasVisPos,possibleposition[53])){
     1082                listOfNeighboors[2]=possibleposition[58]; //north
     1083                listOfNeighboors[3]=possibleposition[52]; //east
     1084                return listOfNeighboors[indexForSWNE];
     1085            }
     1086            else if(findpos(pacLasVisPos,possibleposition[54])){
     1087                listOfNeighboors[0]=possibleposition[42]; //south
     1088                listOfNeighboors[1]=possibleposition[55]; //west
     1089                listOfNeighboors[2]=possibleposition[57]; //north
     1090                return listOfNeighboors[indexForSWNE];
     1091            }
     1092            else if(findpos(pacLasVisPos,possibleposition[55])){
     1093                listOfNeighboors[2]=possibleposition[56]; //north
     1094                listOfNeighboors[3]=possibleposition[54]; //east
     1095                return listOfNeighboors[indexForSWNE];
     1096            }
     1097            else if(findpos(pacLasVisPos,possibleposition[56])){
     1098                listOfNeighboors[0]=possibleposition[55]; //south
     1099                listOfNeighboors[2]=possibleposition[65]; //north
     1100                listOfNeighboors[3]=possibleposition[57]; //east
     1101                return listOfNeighboors[indexForSWNE];
     1102            }
     1103            else if(findpos(pacLasVisPos,possibleposition[57])){
     1104                listOfNeighboors[0]=possibleposition[54]; //south
     1105                listOfNeighboors[1]=possibleposition[56]; //west
     1106                listOfNeighboors[2]=possibleposition[64]; //north
     1107                listOfNeighboors[3]=possibleposition[58]; //east
     1108                return listOfNeighboors[indexForSWNE];
     1109            }
     1110            else if(findpos(pacLasVisPos,possibleposition[58])){
     1111                listOfNeighboors[0]=possibleposition[53]; //south
     1112                listOfNeighboors[1]=possibleposition[57]; //west
     1113                listOfNeighboors[3]=possibleposition[59]; //east
     1114                return listOfNeighboors[indexForSWNE];
     1115            }
     1116            else if(findpos(pacLasVisPos,possibleposition[59])){
     1117                listOfNeighboors[1]=possibleposition[58]; //west
     1118                listOfNeighboors[2]=possibleposition[63]; //north
     1119                listOfNeighboors[3]=possibleposition[60]; //east
     1120                return listOfNeighboors[indexForSWNE];
     1121            }
     1122            else if(findpos(pacLasVisPos,possibleposition[60])){
     1123                listOfNeighboors[1]=possibleposition[59]; //west
     1124                listOfNeighboors[2]=possibleposition[62]; //north
     1125                listOfNeighboors[3]=possibleposition[61]; //east
     1126                return listOfNeighboors[indexForSWNE];
     1127            }
     1128            else if(findpos(pacLasVisPos,possibleposition[61])){
     1129                listOfNeighboors[0]=possibleposition[50]; //south
     1130                listOfNeighboors[1]=possibleposition[60]; //west
     1131                listOfNeighboors[3]=possibleposition[13]; //east
     1132                return listOfNeighboors[indexForSWNE];
     1133            }
     1134            else if(findpos(pacLasVisPos,possibleposition[62])){
     1135                listOfNeighboors[0]=possibleposition[60]; //south
     1136                listOfNeighboors[3]=possibleposition[16]; //east
     1137                return listOfNeighboors[indexForSWNE];
     1138            }
     1139            else if(findpos(pacLasVisPos,possibleposition[63])){
     1140                listOfNeighboors[0]=possibleposition[59]; //south
     1141                listOfNeighboors[1]=possibleposition[64]; //west
     1142                return listOfNeighboors[indexForSWNE];
     1143            }
     1144            else if(findpos(pacLasVisPos,possibleposition[64])){
     1145                listOfNeighboors[0]=possibleposition[57]; //south
     1146                listOfNeighboors[1]=possibleposition[65]; //west
     1147                listOfNeighboors[3]=possibleposition[63]; //east
     1148                return listOfNeighboors[indexForSWNE];
     1149            }
     1150            else if(findpos(pacLasVisPos,possibleposition[65])){
     1151                listOfNeighboors[0]=possibleposition[56]; //south
     1152                listOfNeighboors[3]=possibleposition[64]; //east
     1153                return listOfNeighboors[indexForSWNE];
     1154            }
     1155            else if(findpos(pacLasVisPos,possibleposition[66])){
     1156                //Not back in center
     1157                listOfNeighboors[1]=possibleposition[47]; //west
     1158                listOfNeighboors[3]=possibleposition[48]; //east
     1159                return listOfNeighboors[indexForSWNE];           
     1160            }
     1161
     1162        }
     1163
     1164
    7311165}
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h

    r12316 r12317  
    113113
    114114
     115    //functions taken from PacmanPink
     116
     117
     118    Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);
     119    int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);
     120    Vector3 diffVector (Vector3 start, Vector3 goal);
     121
     122
    115123    };
    116124
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc

    r12304 r12317  
    106106
    107107
    108        
     108        /*
    109109        Vector3 diffVector (Vector3 start, Vector3 goal){
    110110
     
    152152                Vector3 listOfNeighboors[4];
    153153                //first element is south, 2nd west, 3d north, 4th east
    154 
    155                 /*Vector3 possibleposition[67] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-4
    156         Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9
    157         Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14
    158         Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19
    159         Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24
    160         Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29
    161         Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34
    162         Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39
    163         Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44
    164         Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49
    165         Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54
    166         Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59
    167         Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64
    168         Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66*/
    169 
    170 
     154       
    171155
    172156
     
    547531                        return listOfNeighboors[s];           
    548532                }
    549 
     533*/
    550534
    551535        }
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h

    r12304 r12317  
    2222                        void nextMove(Vector3 playerPos, Vector3 redPos);
    2323
    24                         int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);
     24                        //int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);
    2525
    26                         Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);
     26                        //Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);
    2727
    28                         Vector3 diffVector (Vector3 start, Vector3 goal);
     28                        //Vector3 diffVector (Vector3 start, Vector3 goal);
    2929
    3030        };
  • code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc

    r12316 r12317  
    8282            //nextMove(this->getPlayerPos(), redPos);
    8383
     84            int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
     85
    8486
    8587            if(this->actuelposition!=lastPlayerPassedPoint){
    86                 //std::cout<<this->target_x<<" "<<this->target_z<<endl;
    87                 std::cout<<redPos<<endl;
     88               
     89                std::cout<<this->getPlayerPos()<<endl;
    8890                std::cout<<this->lastPlayerPassedPoint<<endl;
    89                 //getShortestPath(Vector3(-215,10,-195),Vector3(70,10,-135));
    90                 //getShortestPath(redPos, lastPlayerPassedPoint);
     91                std::cout<<getPointInFrontOfPacman(lastPlayerPassedPoint, directionV)<<endl;
    9192            nextMove(redPos, lastPlayerPassedPoint);
    92             }/*
     93            }
    9394            else{// red pacman is at lastPlayerPassedPoint
    94             nextMove(this->getPlayerPos(), redPos);
    95             }*/
    9695
    97             //setNewTargetRed(Vector3(70,10,-85));
    98             //std::cout<<this->target_x<<" "<<target_z<<endl;
    99             //std::cout<<"meuh"<<endl;
    100             //std::cout<<this->actuelposition;
     96            //int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
     97
     98            Vector3 pointInFrontOfPlayer = getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
     99
     100            nextMove(redPos, pointInFrontOfPlayer);
     101
     102            //nextMove(this->getPlayerPos(), redPos);
     103            }
     104
    101105
    102106            lockmove=false; //NEVER FORGET THIS ONE !!!!!!!
Note: See TracChangeset for help on using the changeset viewer.