From 7e1a4a4325df04f508ed1d2eaf5fe373f0812d5f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Jun 2020 17:30:36 +0200 Subject: [PATCH] Animationen + Hud fix --- assets/Neuer Ordner/brick.png | Bin 0 -> 236 bytes assets/Pacman_full.png | Bin 227 -> 0 bytes assets/brick.png | Bin 236 -> 205 bytes bin/Game.class | Bin 9481 -> 9735 bytes src/Game.java | 65 +++++++++++++++++++++------------- 5 files changed, 40 insertions(+), 25 deletions(-) create mode 100644 assets/Neuer Ordner/brick.png delete mode 100644 assets/Pacman_full.png diff --git a/assets/Neuer Ordner/brick.png b/assets/Neuer Ordner/brick.png new file mode 100644 index 0000000000000000000000000000000000000000..15db2049b446f5eba7d795ae01eec0a3f42bcefc GIT binary patch literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`j*y!ov7-Hd{oRX06*QmJoCha zrcW!`+<2GB^hkMFE?Cvr<8$VU>4*RO_b;C4#OiRADXb;&y;=ezcS>*^D+8mlGWX&0 c^7;}CrmY(D+ZPGU1v-Yo)78&qol`;+0H3T)T>t<8 literal 0 HcmV?d00001 diff --git a/assets/Pacman_full.png b/assets/Pacman_full.png deleted file mode 100644 index dcbf6c5b7fde689b82db6632e60a91ddac420db6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 227 zcmeAS@N?(olHy`uVBq!ia0vp^B0wz6!3HEJ^yqE{QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XBj({-ZRBb+KpkRfki(`m||Jy5ud<_O14uJ(%epmbtegC*e zDw9jsblaBM^%q?#7xF0yI&Q4pD8G*VQ|vU}X$wr4=lziS-E~*;ebxpxZdGH!oP$nD z-xzHpI(q*|TRGoK`(L)`o%Fv2`xzgcp1*k4X{nMYa?zUv&A%*23X|W-8fwg-?zcki Vz4q%}S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B)UJOL5rPaCd!{5FZ-$XU13{O<=2b(`)V za@8K%)Cu>3QAyhRL&nPOx|^=DPC))&6;9mr3zqgvc<6Oj|7(dn470dXkq19r$Lq-# z_8e8$^V#GOuk-!9W3EA0={)4OShnhgwrX=YUw_o!5X^0wGW204cF2*-7x@lW_*;1C c%?w3mT9HXN(ioP+baWG|bnvupR@~qEH-K7Gy#N3J diff --git a/src/Game.java b/src/Game.java index 1f9315f..89746be 100644 --- a/src/Game.java +++ b/src/Game.java @@ -26,7 +26,7 @@ public class Game { private int score = 0; private JLabel scoreLabel; - + private JLabel fpsLabel; private JLabel liveLabels[]; private int delaytimer = 4; @@ -65,7 +65,7 @@ public class Game { for (int i = 0; i < liveLabels.length; i++) { liveLabels[i] = new Lives(); panel.add(liveLabels[i]); - liveLabels[i].setBounds(710, 30 + 20 * i, 20, 20); + liveLabels[i].setBounds(710 + 20 * i, 35 , 20, 20); } scoreLabel = new JLabel(Integer.toString(score)); @@ -74,7 +74,14 @@ public class Game { scoreLabel.setBounds(710, 0, 500, 50); Font f = new Font("Consolas", Font.BOLD, 24); scoreLabel.setFont(f); - + + fpsLabel = new JLabel(Integer.toString(score)); + panel.add(fpsLabel); + fpsLabel.setForeground(Color.WHITE); + fpsLabel.setBounds(710, 45, 500, 50); + + fpsLabel.setFont(f); + panel.add(player); // Pac-Man wird dem Panel hinzugefügt frame.addKeyListener(player); // KeyListener wird hinzugefügt, man kann nun Pac-Maan mit der tastatur steuern @@ -153,23 +160,7 @@ public class Game { // ----------------------------------------------------------------------------------------------------------------------------------------------------- while (true) { // Hauptschleife - - - for (int i = 0; i < ghosts.length; i++) { - if (ghosts[i].getIsDead()) { - if (ghosts[i].getDeathTimer() != 0) { - ghosts[i].setDeathTimer(ghosts[i].getDeathTimer() - 1); - } else { - ghosts[i].setIsDead(false); - ghosts[i].setPos('x', Map.ghost_posX[i]); - ghosts[i].setPos('y', Map.ghost_posY[i]); - - } - } - } - - frames++; if (ghosts[0].feared == true) { if (Ghost.fearedTimer != 0) { Ghost.fearedTimer--; @@ -395,9 +386,23 @@ public class Game { } } - player.calcDir(0); // Berechnen wo Pac-Man als nächstes hin soll - + + + // Geister LOOP for (int i = 0; i < ghosts.length; i++) { + // + if (ghosts[i].getIsDead()) { + if (ghosts[i].getDeathTimer() != 0) { + ghosts[i].setDeathTimer(ghosts[i].getDeathTimer() - 1); + + } else { + ghosts[i].setIsDead(false); + ghosts[i].setPos('x', Map.ghost_posX[i]); + ghosts[i].setPos('y', Map.ghost_posY[i]); + + } + } + ghosts[i].setLocation(ghosts[i].getPos('x', dt), ghosts[i].getPos('y', dt)); if (player.getPos('x', 0) < ghosts[i].getPos('x', 0) + 18 && player.getPos('x', 0) > ghosts[i].getPos('x', 0) - 18 @@ -430,11 +435,13 @@ public class Game { player.right = false; player.left = false; } + + // Geister LOOP } + // + - fps = 1000000000 / dt; - - delay(delaytimer); // Ein delay zum Ende der Hauptschleife + // Ein delay zum Ende der Hauptschleife if (frames % 100 == 0) { boolean empty = true; @@ -455,10 +462,18 @@ public class Game { if (empty) { scoreLabel.setText("YOU WON"); delay(1000); - System.exit(0); + System.exit(0); // HIER DEN HIGHSCORE IMPLEMENTIEREN } } + player.calcDir(0); // Berechnen wo Pac-Man als nächstes hin soll + fps = 1000000000 / dt; + fpsLabel.setText("fps: " + Integer.toString((int) fps)); + frames++; // FRAMES WIRD HOCHGESETZT + delay(delaytimer); + // } + // ENDE DER WHILE-SCHLEIFE + } // Methode zum verzögern (warten) in ms