From be5b9617b580325305b5e4658828a47ae35b4ebf Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Jun 2020 16:14:03 +0200 Subject: [PATCH] Geister langsamer --- bin/.gitignore | 9 +++++++- bin/Brick.class | Bin 450 -> 450 bytes bin/Game.class | Bin 7008 -> 7031 bytes bin/Ghost.class | Bin 1509 -> 1937 bytes bin/Main.class | Bin 558 -> 558 bytes bin/Map.class | Bin 2447 -> 2447 bytes bin/Picture.class | Bin 1415 -> 1415 bytes bin/Player.class | Bin 3510 -> 3510 bytes src/Game.java | 16 +++++++------ src/Ghost.java | 57 ++++++++++++++++++++++++++++++---------------- 10 files changed, 55 insertions(+), 27 deletions(-) diff --git a/bin/.gitignore b/bin/.gitignore index cc3ed02..277032d 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,2 +1,9 @@ -/Point.class +/Brick.class +/Game.class +/Ghost.class /Lives.class +/Main.class +/Map.class +/Picture.class +/Player.class +/Point.class diff --git a/bin/Brick.class b/bin/Brick.class index 50ef0edbf9e3ab3e130be745f874a171441c4509..98f1c69aeacb64cc67c5adfd0911ce8b54b732c9 100644 GIT binary patch delta 17 ZcmX@ae2AIj)W2Q(7#J8#HgfD@1OPz1273Si delta 17 ZcmX@ae2AIj)W2Q(7#J8VH*)M^1OPzQ27mwn diff --git a/bin/Game.class b/bin/Game.class index 97fc00cae5d52eefcb6736ace1506f72449ed4ab..3e31477f646a8cb7c0715da6adecf5462448db8f 100644 GIT binary patch literal 7031 zcma)B4SZD9mH(f4@6DT;JYYyNq6LJALK2i9@*(mWLIQySqQqceS29T^FgTe>Cj$gp zTdk;7)V0>Cu(p1zZq%}VL}tK(+Lnq))%sPnwJvIPyH>RITLEGJ_r00SM8mf8`^~%O zo^#JR_k7%Q@4IjR(O*0UV4~ESa0&Ezq4ux|UEp66S{JH_hGMHKmNc&kwwP&oy4sO&Ql<9 zT6?I2!h(xJ9qhSUsaO^e5e;=F>)Cd;#1ou^)Czny91J!0qt?b!fG-+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17 YcmeAd?ic1b^>5cc1_lPpjU4Tq06X^v4*&oF diff --git a/bin/Picture.class b/bin/Picture.class index f720bca0ebe0c6c5649446ce9cce8fd8400937c9..3737254b48ab4d6c68bbddd077d0d3181feadfaa 100644 GIT binary patch delta 17 YcmZqYZs+DW^>5cc1_lO`jU4r?06E$P-T(jq delta 17 YcmZqYZs+DW^>5cc1_lPpjU4r?06Fso;{X5v diff --git a/bin/Player.class b/bin/Player.class index daa323be927ba65b345a866a938d35138a59061d..56c9ae4972f3b46b05750493d0c09f33c2d20359 100644 GIT binary patch delta 17 Zcmdlcy-k|q)W2Q(7#J8#Hgc@v1pq<-29p2) delta 17 Zcmdlcy-k|q)W2Q(7#J8VH*&1w1pq=B2ABW< diff --git a/src/Game.java b/src/Game.java index 4ca878b..fdfdbaa 100644 --- a/src/Game.java +++ b/src/Game.java @@ -28,7 +28,7 @@ public class Game { private JLabel liveLabels[]; - private int delaytimer = 12; + private int delaytimer = 4; @SuppressWarnings("unused") private long fps = 60; @@ -41,7 +41,7 @@ public class Game { // oben links (0|0) // nach rechts --> x wird größer // nach unten --> y wird größer - + public static int frames; int minn; int[] HCost = new int[4]; @@ -125,7 +125,8 @@ public class Game { lastT = System.nanoTime(); // delta time while (true) { // Hauptschleife - + frames ++; + dt = System.nanoTime() - lastT; // delta time lastT = System.nanoTime(); // delta time @@ -194,8 +195,9 @@ public class Game { minn = HCost[j]; } } - - for (int j = 0; j < 4; j++) { + + if ((frames % 2) != 0) { + for (int j = 0; j < 4; j++) { if (HCost[j] == minn) { if (j == 0) { ghosts[i].right = true; @@ -224,10 +226,10 @@ public class Game { ghosts[i].left = false; ghosts[i].up = false; break; + } } } } - } // Kollision von Pac-Man mit Bricks: @@ -297,7 +299,7 @@ public class Game { if (player.lives == 0) { System.exit(0); } - System.out.println(player.lives); + delay(200); for (int j = 0; j < ghosts.length; j++) { ghosts[j].setPos('x', Map.ghost_posX[j]); diff --git a/src/Ghost.java b/src/Ghost.java index d87b090..1023d09 100644 --- a/src/Ghost.java +++ b/src/Ghost.java @@ -11,20 +11,21 @@ public class Ghost extends Picture { // Die public boolean down; public boolean left; public boolean right; - + private int HCost; - - public Ghost(int index) { - + private int type; + public Ghost(int type) { + + super("Pinky"); // Aufrufen der übergeordneten Klasse - + this.type = type; // xPos = 150 + 40 * index; - if (index == 0) { + if (type == 0) { this.changeSauce("Blinky"); - } else if (index == 2) { + } else if (type == 2) { this.changeSauce("Inky"); - } else if (index == 3) { + } else if (type == 3) { this.changeSauce("Clyde"); } @@ -39,27 +40,45 @@ public class Ghost extends Picture { // Die } public int getHCost(Player player, int mod_x, int mod_y) { + if (type == 0) { - HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) - + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)); - + HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) + + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)); + } else if (type == 1) { + HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10 + 80) / 20), 2) + + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)); + } else if (type == 2) { + HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((300 - 10 + 80) / 20), 2) + + Math.pow((((yPos - 10) / 20) + mod_y) - ((100 - 10) / 20), 2)); + } else if (type == 3) { + HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) + + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) + 100 - 10) / 20), 2)); + } return HCost; } public int getPos(char coordinate, long dt) { // Hier kommt die zuvor erwähnte delta time ins Spiel if (coordinate == 'x') { // Auslesen der 'x' - Koordinate: - if (left && dt != 0) { - xPos -= 1; - } else if (right && dt != 0) { - xPos += 1; + if (left && dt != 0 && (Game.frames % 3) == 0) { + + xPos -= 1; + + } else if (right && dt != 0 && (Game.frames % 3) == 0) { + + xPos += 1; + } return (int) xPos; } else if (coordinate == 'y') { // Auslesen der 'y' - Koordinate: - if (down && dt != 0) { - yPos += 1; - } else if (up && dt != 0) { - yPos -= 1; + if (down && dt != 0 && (Game.frames % 3) == 0) { + + yPos += 1; + + } else if (up && dt != 0 && (Game.frames % 3) == 0) { + + yPos -= 1; + } return (int) yPos; // (int) } else {