diff --git a/assets/Map.txt b/assets/Map.txt index 7851a67..89bbe50 100644 --- a/assets/Map.txt +++ b/assets/Map.txt @@ -4,7 +4,7 @@ # # # ## ### ##### # # # ########## ### ########## # # # ################# ##### ##### -# # # # #### #### +# # # # # #### #### # # # # #################### ###### # # # # # P####### ###### # # # # # ################## ###### diff --git a/bin/Game.class b/bin/Game.class index 9cea366..d9d8a4d 100644 Binary files a/bin/Game.class and b/bin/Game.class differ diff --git a/bin/Ghost.class b/bin/Ghost.class index 6a4645c..7a20a84 100644 Binary files a/bin/Ghost.class and b/bin/Ghost.class differ diff --git a/src/Game.java b/src/Game.java index 9b3a999..2fdf780 100644 --- a/src/Game.java +++ b/src/Game.java @@ -117,6 +117,7 @@ public class Game { if (Map.bricks[((ghosts[i].getPos('y', 0) - 10) / 20) + 1][(ghosts[i].getPos('x', 0) - 10) / 20] == null) { ghost_down_possible[i] = true; + } if (Map.bricks[(ghosts[i].getPos('y', 0) - 10) / 20][((ghosts[i].getPos('x', 0) - 10) / 20) - 1] == null) { @@ -126,11 +127,6 @@ public class Game { + 1] == null) { ghost_right_possible[i] = true; } - - System.out.println("up: " + ghost_up_possible[i] + " | down: " + ghost_down_possible[i] + " | left: " - + ghost_left_possible[i] + " | right: " + ghost_right_possible[i]); - - // System.out.println((ghosts[i].getPos('y', 0) - 10) / 20); ghost_up_possible[i] = false; ghost_down_possible[i] = false; @@ -138,6 +134,7 @@ public class Game { ghost_right_possible[i] = false; } + System.out.println(ghosts[0].getHCost(player)); // Kollision von Pac-Man mit Bricks: for (int i = 0; i < 35; i++) { // für jeden Brick diff --git a/src/Ghost.java b/src/Ghost.java index 8d2b66b..0dad550 100644 --- a/src/Ghost.java +++ b/src/Ghost.java @@ -8,8 +8,6 @@ public class Ghost extends Picture { // Die private int yPos; private int HCost; - private int GCost; - private int FCost; public Ghost(int index) { @@ -59,10 +57,13 @@ public class Ghost extends Picture { // Die } - public int getHCost() { + public int getHCost(Player player) { + HCost = (int) Math.sqrt(Math.pow(xPos - player.getPos('x', 0), 2) + Math.pow(yPos - player.getPos('y', 0), 2)); return HCost; } + + }