}
public void doMove() {
- this.m_locX += this.m_dx;
- this.m_locY += this.m_dy;
+ if((this.m_dx == -1) && (this.m_locX == 0)) {
+ // go left and currently this.m_locX is 0
+ this.m_locX = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dx == 1) && (this.m_locX == this.m_map.m_nrofblocks - 1)) {
+ this.m_locX = 0;
+ } else {
+ this.m_locX += this.m_dx;
+ }
+
+ if((this.m_dy == -1) && (this.m_locY == 0)) {
+ // go up and currently this.m_locY is 0
+ this.m_locY = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dy == 1) && (this.m_locY == this.m_map.m_nrofblocks - 1)) {
+ this.m_locY = 0;
+ } else {
+ this.m_locY += this.m_dy;
+ }
this.m_dx = 0;
this.m_dy = 0;
//System.printString("Ghost " + this.m_index + ": (" + this.m_locX + ", " + this.m_locY + ")\n");
map.m_desY[i] = ty*(i%2);\r
map.m_pacOriX[i] = pacman.m_locX;\r
map.m_pacOriY[i] = pacman.m_locY;\r
- map.m_leftLives[i] = map.m_leftLevels[i] = 60;\r
- pacman.m_leftLives = pacman.m_leftLevels = 60;\r
+ map.m_leftLives[i] = map.m_leftLevels[i] = 20;\r
+ pacman.m_leftLives = pacman.m_leftLevels = 20;\r
map.m_pacmen[i] = pacman;\r
//System.printString("destination: " + map.desX[i] + "," + map.desY[i] + "\n");\r
}\r
}\r
\r
public void doMove() {\r
- this.m_locX += this.m_dx;\r
- this.m_locY += this.m_dy;\r
+ if((this.m_dx == -1) && (this.m_locX == 0)) {\r
+ // go left and currently this.m_locX is 0\r
+ this.m_locX = this.m_map.m_nrofblocks - 1;\r
+ } else if((this.m_dx == 1) && (this.m_locX == this.m_map.m_nrofblocks - 1)) {\r
+ this.m_locX = 0;\r
+ } else {\r
+ this.m_locX += this.m_dx;\r
+ }\r
+\r
+ if((this.m_dy == -1) && (this.m_locY == 0)) {\r
+ // go up and currently this.m_locY is 0\r
+ this.m_locY = this.m_map.m_nrofblocks - 1;\r
+ } else if((this.m_dy == 1) && (this.m_locY == this.m_map.m_nrofblocks - 1)) {\r
+ this.m_locY = 0;\r
+ } else {\r
+ this.m_locY += this.m_dy;\r
+ }\r
this.m_dx = 0;\r
this.m_dy = 0;\r
//System.printString("Pacmen " + this.m_index + ": (" + this.m_locX + ", " + this.m_locY + ")\n");\r
}
public void doMove() {
- this.m_locX += this.m_dx;
- this.m_locY += this.m_dy;
+ if((this.m_dx == -1) && (this.m_locX == 0)) {
+ // go left and currently this.m_locX is 0
+ this.m_locX = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dx == 1) && (this.m_locX == this.m_map.m_nrofblocks - 1)) {
+ this.m_locX = 0;
+ } else {
+ this.m_locX += this.m_dx;
+ }
+
+ if((this.m_dy == -1) && (this.m_locY == 0)) {
+ // go up and currently this.m_locY is 0
+ this.m_locY = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dy == 1) && (this.m_locY == this.m_map.m_nrofblocks - 1)) {
+ this.m_locY = 0;
+ } else {
+ this.m_locY += this.m_dy;
+ }
this.m_dx = 0;
this.m_dy = 0;
//System.printString("Ghost " + this.m_index + ": (" + this.m_locX + ", " + this.m_locY + ")\n");
map.m_desY[i] = ty*(i%2);
map.m_pacOriX[i] = pacman.m_locX;
map.m_pacOriY[i] = pacman.m_locY;
- map.m_leftLives[i] = map.m_leftLevels[i] = 60;
- pacman.m_leftLives = pacman.m_leftLevels = 60;
+ map.m_leftLives[i] = map.m_leftLevels[i] = 20;
+ pacman.m_leftLives = pacman.m_leftLevels = 20;
}
map.m_ghostcount = 0;
//System.printString("Pacman " + p.m_index + ": (" + map.m_pacMenX[p.m_index] + "," + map.m_pacMenY[p.m_index] + ")\n");
boolean death = map.check(p);
/*} else {
- map.m_deathcount++;
map.m_paccount++;
}*/
}
public void doMove() {
- this.m_locX += this.m_dx;
- this.m_locY += this.m_dy;
+ if((this.m_dx == -1) && (this.m_locX == 0)) {
+ // go left and currently this.m_locX is 0
+ this.m_locX = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dx == 1) && (this.m_locX == this.m_map.m_nrofblocks - 1)) {
+ this.m_locX = 0;
+ } else {
+ this.m_locX += this.m_dx;
+ }
+
+ if((this.m_dy == -1) && (this.m_locY == 0)) {
+ // go up and currently this.m_locY is 0
+ this.m_locY = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dy == 1) && (this.m_locY == this.m_map.m_nrofblocks - 1)) {
+ this.m_locY = 0;
+ } else {
+ this.m_locY += this.m_dy;
+ }
this.m_dx = 0;
this.m_dy = 0;
//System.printString("Pacmen " + this.m_index + ": (" + this.m_locX + ", " + this.m_locY + ")\n");
}
public void doMove() {
- this.m_locX += this.m_dx;
- this.m_locY += this.m_dy;
+ if((this.m_dx == -1) && (this.m_locX == 0)) {
+ // go left and currently this.m_locX is 0
+ this.m_locX = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dx == 1) && (this.m_locX == this.m_map.m_nrofblocks - 1)) {
+ this.m_locX = 0;
+ } else {
+ this.m_locX += this.m_dx;
+ }
+
+ if((this.m_dy == -1) && (this.m_locY == 0)) {
+ // go up and currently this.m_locY is 0
+ this.m_locY = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dy == 1) && (this.m_locY == this.m_map.m_nrofblocks - 1)) {
+ this.m_locY = 0;
+ } else {
+ this.m_locY += this.m_dy;
+ }
this.m_dx = 0;
this.m_dy = 0;
//System.printString("Ghost " + this.m_index + ": (" + this.m_locX + ", " + this.m_locY + ")\n");
map.m_desY[i] = ty*(i%2);
map.m_pacOriX[i] = pacman.m_locX;
map.m_pacOriY[i] = pacman.m_locY;
- map.m_leftLives[i] = map.m_leftLevels[i] = 60;
- pacman.m_leftLives = pacman.m_leftLevels = 60;
+ map.m_leftLives[i] = map.m_leftLevels[i] = 20;
+ pacman.m_leftLives = pacman.m_leftLevels = 20;
//map.m_destinationX[i] = pacman.m_locX;
//map.m_destinationY[i] = pacman.m_locY;
}
//System.printString("Pacman " + p.m_index + ": (" + map.m_pacMenX[p.m_index] + "," + map.m_pacMenY[p.m_index] + ")\n");
boolean death = map.check(p);
} else {
- map.m_deathcount++;
map.m_paccount++;
}
}
public void doMove() {
- this.m_locX += this.m_dx;
- this.m_locY += this.m_dy;
+ if((this.m_dx == -1) && (this.m_locX == 0)) {
+ // go left and currently this.m_locX is 0
+ this.m_locX = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dx == 1) && (this.m_locX == this.m_map.m_nrofblocks - 1)) {
+ this.m_locX = 0;
+ } else {
+ this.m_locX += this.m_dx;
+ }
+
+ if((this.m_dy == -1) && (this.m_locY == 0)) {
+ // go up and currently this.m_locY is 0
+ this.m_locY = this.m_map.m_nrofblocks - 1;
+ } else if((this.m_dy == 1) && (this.m_locY == this.m_map.m_nrofblocks - 1)) {
+ this.m_locY = 0;
+ } else {
+ this.m_locY += this.m_dy;
+ }
this.m_dx = 0;
this.m_dy = 0;
//System.printString("Pacmen " + this.m_index + ": (" + this.m_locX + ", " + this.m_locY + ")\n");