nur ne kÃleineAenderung

master
Lenz Wiechers 2020-05-21 16:39:25 +02:00
parent b43fb65fb3
commit d6c82f4e4c
5 changed files with 7 additions and 9 deletions

View File

@ -4,7 +4,7 @@
# # # ## ### ##### # # # ## ### #####
# # # ########## ### ########## # # # ########## ### ##########
# # # ################# ##### ##### # # # ################# ##### #####
# # # # #### #### # # # # # #### ####
# # # # #################### ###### # # # # #################### ######
# # # # # P####### ###### # # # # # P####### ######
# # # # # ################## ###### # # # # # ################## ######

Binary file not shown.

Binary file not shown.

View File

@ -117,6 +117,7 @@ public class Game {
if (Map.bricks[((ghosts[i].getPos('y', 0) - 10) / 20) + 1][(ghosts[i].getPos('x', 0) - 10) if (Map.bricks[((ghosts[i].getPos('y', 0) - 10) / 20) + 1][(ghosts[i].getPos('x', 0) - 10)
/ 20] == null) { / 20] == null) {
ghost_down_possible[i] = true; ghost_down_possible[i] = true;
} }
if (Map.bricks[(ghosts[i].getPos('y', 0) - 10) / 20][((ghosts[i].getPos('x', 0) - 10) / 20) if (Map.bricks[(ghosts[i].getPos('y', 0) - 10) / 20][((ghosts[i].getPos('x', 0) - 10) / 20)
- 1] == null) { - 1] == null) {
@ -126,11 +127,6 @@ public class Game {
+ 1] == null) { + 1] == null) {
ghost_right_possible[i] = true; 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_up_possible[i] = false;
ghost_down_possible[i] = false; ghost_down_possible[i] = false;
@ -138,6 +134,7 @@ public class Game {
ghost_right_possible[i] = false; ghost_right_possible[i] = false;
} }
System.out.println(ghosts[0].getHCost(player));
// Kollision von Pac-Man mit Bricks: // Kollision von Pac-Man mit Bricks:
for (int i = 0; i < 35; i++) { // für jeden Brick for (int i = 0; i < 35; i++) { // für jeden Brick

View File

@ -8,8 +8,6 @@ public class Ghost extends Picture { // Die
private int yPos; private int yPos;
private int HCost; private int HCost;
private int GCost;
private int FCost;
public Ghost(int index) { 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; return HCost;
} }
} }