diff --git a/bin/.gitignore b/bin/.gitignore index 7d0393d..99d9929 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1 +1,14 @@ +/BigPoint.class +/Brick.class +/Game.class +/Ghost.class +/Hintergrund.class +/Lives.class +/Main.class +/Map.class /MapMenu$1.class +/MapMenu.class +/Picture.class +/Player.class +/Point.class +/Portal.class diff --git a/bin/BigPoint.class b/bin/BigPoint.class index c61b68a..e13d6a9 100644 Binary files a/bin/BigPoint.class and b/bin/BigPoint.class differ diff --git a/bin/Brick.class b/bin/Brick.class index 50ef0ed..98f1c69 100644 Binary files a/bin/Brick.class and b/bin/Brick.class differ diff --git a/bin/Game.class b/bin/Game.class index c157166..5844c8f 100644 Binary files a/bin/Game.class and b/bin/Game.class differ diff --git a/bin/Ghost.class b/bin/Ghost.class index 2280ed8..376c1e8 100644 Binary files a/bin/Ghost.class and b/bin/Ghost.class differ diff --git a/bin/Hintergrund.class b/bin/Hintergrund.class index e25986c..10d6ae6 100644 Binary files a/bin/Hintergrund.class and b/bin/Hintergrund.class differ diff --git a/bin/Lives.class b/bin/Lives.class index 4ea4f45..00ef116 100644 Binary files a/bin/Lives.class and b/bin/Lives.class differ diff --git a/bin/Main.class b/bin/Main.class index 03e66e9..084339f 100644 Binary files a/bin/Main.class and b/bin/Main.class differ diff --git a/bin/Map.class b/bin/Map.class index 47423ff..386fbdb 100644 Binary files a/bin/Map.class and b/bin/Map.class differ diff --git a/bin/MapMenu.class b/bin/MapMenu.class index b1f4684..1d6814f 100644 Binary files a/bin/MapMenu.class and b/bin/MapMenu.class differ diff --git a/bin/Point.class b/bin/Point.class index 8be2f7a..c366510 100644 Binary files a/bin/Point.class and b/bin/Point.class differ diff --git a/bin/Portal.class b/bin/Portal.class index be456d5..1eaeaf9 100644 Binary files a/bin/Portal.class and b/bin/Portal.class differ diff --git a/src/Game.java b/src/Game.java index 0f117fd..b29831e 100644 --- a/src/Game.java +++ b/src/Game.java @@ -292,6 +292,7 @@ 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 + if (Map.bricks[j][i] != null) { // Damit kein Fehler auftritt wegen nicht vorhandenen Bricks if (player.getPos('x', 0) < Map.bricks[j][i].xPos + 20 && player.getPos('x', 0) > Map.bricks[j][i].xPos - 20 @@ -317,10 +318,6 @@ public class Game { } } - } - } - 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 @@ -336,32 +333,7 @@ public class Game { } } - } - } - if (Map.Left != null) { - if (player.getPos('x', 0) < Map.Left.xPos + 20 && player.getPos('x', 0) > Map.Left.xPos - 20 - && player.getPos('y', 0) < Map.Left.yPos + 20 && player.getPos('y', 0) > Map.Left.yPos - 20) { - if (Map.Right != null) { - player.xPos = Map.Right.xPos - 20; - player.yPos = Map.Right.yPos; - - } - } - } - if (Map.Right != null) { - if (player.getPos('x', 0) < Map.Right.xPos + 20 && player.getPos('x', 0) > Map.Right.xPos - 20 - && player.getPos('y', 0) < Map.Right.yPos + 20 && player.getPos('y', 0) > Map.Right.yPos - 20) { - - if (Map.Left != null) { - player.xPos = Map.Left.xPos + 20; - player.yPos = Map.Left.yPos; - - } - } - } - for (int i = 0; i < 35; i++) { - for (int j = 0; j < 35; j++) { if (Map.bigpoints[j][i] != null) { if (player.getPos('x', 0) < Map.bigpoints[j][i].xPos + 6 && player.getPos('x', 0) > Map.bigpoints[j][i].xPos - 6 @@ -395,6 +367,30 @@ public class Game { } } + + } + } + + if (Map.Left != null) { + if (player.getPos('x', 0) < Map.Left.xPos + 20 && player.getPos('x', 0) > Map.Left.xPos - 20 + && player.getPos('y', 0) < Map.Left.yPos + 20 && player.getPos('y', 0) > Map.Left.yPos - 20) { + + if (Map.Right != null) { + player.xPos = Map.Right.xPos - 20; + player.yPos = Map.Right.yPos; + + } + } + } + if (Map.Right != null) { + if (player.getPos('x', 0) < Map.Right.xPos + 20 && player.getPos('x', 0) > Map.Right.xPos - 20 + && player.getPos('y', 0) < Map.Right.yPos + 20 && player.getPos('y', 0) > Map.Right.yPos - 20) { + + if (Map.Left != null) { + player.xPos = Map.Left.xPos + 20; + player.yPos = Map.Left.yPos; + + } } }