From 963c537de672e9c5eb100282d54a249f4f03bd5e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 7 Jun 2020 21:24:52 +0200 Subject: [PATCH] always og. bei mapauswahl --- bin/Game.class | Bin 10121 -> 9635 bytes bin/Ghost.class | Bin 2784 -> 2784 bytes src/Game.java | 16 +++++++--------- src/Ghost.java | 4 ++-- src/Main.java | 2 +- src/MapMenu.java | 6 +++--- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/bin/Game.class b/bin/Game.class index 2d0ff96518b582b8543c9a74e4ed2662fd28bf76..2075519c39a18b8b6c1520b58e1ff6d1593f14ac 100644 GIT binary patch delta 4755 zcma)A33wD$60U!`XS!#mXL>>=7$977CE*^CI|_0LBph-EB0|UvNi-KpAOVy?1?3Xa z5g`c3CG)v}N)kp8#Gv0sP*D^GT@gP-*L6J*RCJMJ>rGECVEy*{lI~Z3RsB`<-kVq5 zy>#@}WZOGeUpq)dJ+NxG&7%6N=m(8{q@O@?if?8yNKF}&Us#-;)6Ys(^s`3ih0Z)S zJ2R`;O25!?g?yKQu<<3^Mt{&Hh5iF_-Jd=uy=zW-US`*EbBl_7xf=aRmzg&& zJuiQJcCHU3#V3rg66mT%{wQ+U2q2CBw{ak^FDHGjjmARKAj1r@X8MYU7Y+8Md&7=X zgig_*!U}S*jy1(ug10cNA1?HE4Vqwc6xG)YjZ=e8Ynhcbg4LhyC5v!p|LyyT^5}Ik$f}*YL+gw8nv}E6z zzVt#LCyyxtZmr=~iU!#Y*dNYZ#A>Ud9d!UH`I+O=XJ`0?aR&|Y!q}QWbLP;(^ju$& zh>@s~E@my20>Y@XMkmpQ`G<;$?53eRJiMA2`FV5r7C$s$xUlM>(Z}c_4_r$m4{Rka zn}}?rjzu30ebFz_&EC?Vq~Q(`PxfXPh7%Z|VW23&TxhKSSParISRir^?-oHkRKwk2 zz?)x^CxGD^MhL((yTD4R7{rOfEk*;xg_B7YnNGz$8pcu^E|@2GyswnWqEpdBs5`4@ zA*N)KhSb0ry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N0ou$(Xg6;~hq)Y`=KYA8Yp}-L zis#Mkc*)#}-R5rm*4&Fd=6>uoU&kxv2l$<39^t{K41SIM<}n;FPv8$;9S6N`9Pp-N zzc&kScn9H6-Vu1yI|grg3urwaAi`A25|rr^ z7D;qB6`_?7J@COE=LsfSp%Zhciqu3Z@(Z0w1F%$Gv zv_FRFYw5WdW&}_j!;A$ejbZM0a4?3MdHh|=Hs9P!EqEAXNHO=(5PQ~P9;6I=RyF_K zjg9;<0b(NuHI1se=sr?Zf{INlU82%8AR606hu8-j48M^*1`EU5z&p~BKJ+ItFz7gq zPwArJ>`{zj%fM`lKj83U4CIxmFK|W6Dva6l|!P4?BH1*YIRG#c1!MpK delta 14 VcmaDL`apEU1tvz7%@>*YIRGxy1up;q diff --git a/src/Game.java b/src/Game.java index dc7ef47..ae337a3 100644 --- a/src/Game.java +++ b/src/Game.java @@ -133,7 +133,7 @@ public class Game { } } } - System.out.println(Map.Left + " " + Map.Right); + if (Map.Left != null && Map.Right != null) { panel.add(Map.Left); panel.add(Map.Right); @@ -158,7 +158,7 @@ public class Game { if (ghosts[i].getIsDead()) { if (ghosts[i].getDeathTimer() != 0) { ghosts[i].setDeathTimer(ghosts[i].getDeathTimer() - 1); - // System.out.println(ghosts[i].getDeathTimer()); + } else { ghosts[i].setIsDead(false); ghosts[i].setPos('x', Map.ghost_posX[i]); @@ -184,8 +184,7 @@ public class Game { dt = System.nanoTime() - lastT; // delta time lastT = System.nanoTime(); // delta time - // Zu Beginn jeden Schleifendurchlaufs wird die Position von Pac-Man neu - // gesetzt: + player.setLocation(player.getPos('x', dt), player.getPos('y', dt)); for (int i = 0; i < ghosts.length; i++) { @@ -249,8 +248,8 @@ public class Game { minn = HCost[j]; } } - // System.out.println(HCost[0] + " " + HCost[1] + " " + HCost[2] + " " + - // HCost[3]); + + for (int j = 0; j < 4; j++) { if (HCost[j] == minn) { if (frames % Ghost.offFrames == 0) { @@ -415,8 +414,7 @@ public class Game { ghosts[i].setPos('x', -100); ghosts[i].setPos('y', -100); score += 1000; - System.out.println("Geist" + i + " ist gestorben" + ghosts[i].getIsDead()); - + } else { player.lives--; @@ -441,7 +439,7 @@ public class Game { fps = 1000000000 / dt; - // System.out.println("fps: " + fps); + delay(delaytimer); // Ein delay zum Ende der Hauptschleife diff --git a/src/Ghost.java b/src/Ghost.java index 28547a4..6f5b4d0 100644 --- a/src/Ghost.java +++ b/src/Ghost.java @@ -63,7 +63,7 @@ public class Ghost extends Picture { // Die .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) - ((200 - 10 + 80) / 20), 2) + HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((200 - 10 + 80) / 20), 2) + Math.pow((((yPos - 10) / 20) + mod_y) - ((200 - 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) @@ -71,7 +71,7 @@ public class Ghost extends Picture { // Die } } else { - HCost = 10 * (1 / (Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) + HCost = 100 * (1 / (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)))); } diff --git a/src/Main.java b/src/Main.java index a00b1a1..8630b62 100644 --- a/src/Main.java +++ b/src/Main.java @@ -10,7 +10,7 @@ public class Main { System.setProperty("sun.java2d.opengl", "true"); - // Game game = new Game("map1.txt"); // Das Spiel wird gestartet + MapMenu menu = new MapMenu(); diff --git a/src/MapMenu.java b/src/MapMenu.java index 6712d7c..fb43125 100644 --- a/src/MapMenu.java +++ b/src/MapMenu.java @@ -71,9 +71,9 @@ public class MapMenu extends JFrame { } } }); - + bob = new JComboBox(maps); - bob.setSelectedIndex(4); + bob.setSelectedItem("Original"); panel.add(bob); bob.setBounds(70, 10, 120, 30); @@ -86,7 +86,7 @@ public class MapMenu extends JFrame { // Was passieren soll, wenn der Button gedrückt wird public void button_ActionPerformed(ActionEvent evt) throws SQLException { selectedMap = String.valueOf(bob.getSelectedItem()); - System.out.println(selectedMap + " is now the selected Map!"); + rdy = true; this.setVisible(false); }