diff --git a/bin/Brick.class b/bin/Brick.class index 98f1c69..50ef0ed 100644 Binary files a/bin/Brick.class and b/bin/Brick.class differ diff --git a/bin/Game.class b/bin/Game.class index 2c5cf7e..a1e5f92 100644 Binary files a/bin/Game.class and b/bin/Game.class differ diff --git a/bin/Ghost.class b/bin/Ghost.class index 9c699c4..a0531e2 100644 Binary files a/bin/Ghost.class and b/bin/Ghost.class differ diff --git a/bin/Main.class b/bin/Main.class index ef3f066..1a83356 100644 Binary files a/bin/Main.class and b/bin/Main.class differ diff --git a/bin/Map.class b/bin/Map.class index a6770a9..e1ba2c3 100644 Binary files a/bin/Map.class and b/bin/Map.class differ diff --git a/bin/Picture.class b/bin/Picture.class index 3737254..f720bca 100644 Binary files a/bin/Picture.class and b/bin/Picture.class differ diff --git a/bin/Player.class b/bin/Player.class index cc24057..215dc9b 100644 Binary files a/bin/Player.class and b/bin/Player.class differ diff --git a/src/Game.java b/src/Game.java index bc43def..0da0e2e 100644 --- a/src/Game.java +++ b/src/Game.java @@ -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,13 +253,29 @@ 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); - - System.out.println("" + conv(player.yPos) + " " + conv(player.xPos)); + 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); + + } + } + } } - - + + /* + * 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 for (int i = 0; i < ghosts.length; i++) {