punkte kollision gefixt

master
Lenz Wiechers 2020-06-06 13:43:47 +02:00
parent c3cdb120c6
commit 63b85260fd
8 changed files with 22 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -223,7 +223,6 @@ public class Game {
}
// Kollision von Pac-Man mit Bricks:
for (int i = 0; i < 35; i++) { // für jeden Brick
for (int j = 0; j < 35; j++) { // für jeden Brick
@ -254,12 +253,28 @@ public class Game {
}
}
}
if ((player.getPos('x', 0) - 10) % 20 == 0 && (player.getPos('y', 0) - 10) % 20 == 0 && Map.points[conv(player.getPos('y', 0))][conv(player.getPos('x', 0))] != null) {
Map.points[conv(player.yPos)][conv(player.xPos)].setBounds(0, 0, 0, 0);
for (int i = 0; i < 35; i++) {
for (int j = 0; j < 35; j++) {
if (Map.points[j][i] != null) {
if (player.getPos('x', 0) < Map.points[j][i].xPos + 5
&& player.getPos('x', 0) > Map.points[j][i].xPos - 5
&& player.getPos('y', 0) < Map.points[j][i].yPos + 5
&& player.getPos('y', 0) > Map.points[j][i].yPos - 5) {
Map.points[j][i].setBounds(0, 0, 0, 0);
System.out.println("" + conv(player.yPos) + " " + conv(player.xPos));
}
}
}
}
/*
* if ((player.getPos('x', 0) - 10) % 20 == 0 && (player.getPos('y', 0) - 10) %
* 20 == 0 && Map.points[conv(player.getPos('y', 0))][conv(player.getPos('x',
* 0))] != null) { Map.points[conv(player.yPos)][conv(player.xPos)].setBounds(0,
* 0, 0, 0);
*
* }
*/
player.calcDir(0); // Berechnen wo Pac-Man als nächstes hin soll