From 07a7b02819e9e7a6a3cec56451bf2fb5a7a885be Mon Sep 17 00:00:00 2001 From: Lenz Date: Tue, 9 Jun 2020 18:58:43 +0200 Subject: [PATCH] game wird neugestartet, nachdem man gestorben ist --- bin/.gitignore | 14 ------------ bin/BigPoint.class | Bin 462 -> 462 bytes bin/Brick.class | Bin 450 -> 450 bytes bin/Game.class | Bin 9832 -> 9858 bytes bin/Ghost.class | Bin 2824 -> 2824 bytes bin/Hintergrund.class | Bin 394 -> 394 bytes bin/Lives.class | Bin 336 -> 336 bytes bin/Main.class | Bin 1327 -> 1547 bytes bin/Map.class | Bin 2892 -> 2892 bytes bin/MapMenu$1.class | Bin 0 -> 784 bytes bin/MapMenu.class | Bin 3085 -> 3109 bytes bin/Picture.class | Bin 1415 -> 1415 bytes bin/Player.class | Bin 4349 -> 4349 bytes bin/Point.class | Bin 450 -> 450 bytes bin/Portal.class | Bin 454 -> 454 bytes src/Game.java | 8 +++---- src/Main.java | 52 +++++++++++++++++++++++++++++------------- 17 files changed, 40 insertions(+), 34 deletions(-) delete mode 100644 bin/.gitignore create mode 100644 bin/MapMenu$1.class diff --git a/bin/.gitignore b/bin/.gitignore deleted file mode 100644 index 99d9929..0000000 --- a/bin/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/BigPoint.class -/Brick.class -/Game.class -/Ghost.class -/Hintergrund.class -/Lives.class -/Main.class -/Map.class -/MapMenu$1.class -/MapMenu.class -/Picture.class -/Player.class -/Point.class -/Portal.class diff --git a/bin/BigPoint.class b/bin/BigPoint.class index e13d6a937dea2cd8c7a7638fd757da5d267f3548..c61b68a03100e48b0e700e8b5820a384917fb07d 100644 GIT binary patch delta 17 ZcmX@de2$sp)W2Q(7#J8VH*y?f1OP&92BZK0 delta 17 ZcmX@de2$sp)W2Q(7#J8#HgX(e1OP%*2A==` diff --git a/bin/Brick.class b/bin/Brick.class index 98f1c69aeacb64cc67c5adfd0911ce8b54b732c9..50ef0edbf9e3ab3e130be745f874a171441c4509 100644 GIT binary patch delta 17 ZcmX@ae2AIj)W2Q(7#J8VH*)M^1OPzQ27mwn delta 17 ZcmX@ae2AIj)W2Q(7#J8#HgfD@1OPz1273Si diff --git a/bin/Game.class b/bin/Game.class index 5bd7d584030331b9c3e5d4155b5f1626ff1b4e14..77f5f5165fd09da024727969b2233f208010b878 100644 GIT binary patch delta 2101 zcma)-dsG$I6~@2s-nsL*Gk0df1z*S&0zN=dv1(eQNn9p~5qwlrLc5Znpsmp?Eu<9` za*cvTqcwCC#VCrR7_T&)Dt*hY*^nk>_1X_}=b)`&G}eI%}m8hb8~SJOZG&&+qe zv-fY$*)!)%d;0PW@9{4V9R~0N?rZSg(C4cBC81_beIz!0>WrBhPO-pXA^gHzG%M$c zMGNyE4Vz017Jbvq(m+0AARY-Smk~;skU4dV7eC>0gDcP~yqsAJavq$Qr?S*pV4Rj; z;8ulOoN2zOK2_XCc=8v_nX`zH20fhkBQLADQ{fIL=!<8~{++%AY9By`3fNQjzhjI_Q{_gfW2!8Rl};{4ZThkhr@&wFNvoXe4M&dzQ~_WuR>R#Ycs|K-RInNiNA=skgX zVxf=Q1zHH_x|iHJ_=_EpTf=mxp>JOf6W8977)Cgk`aZ@cXHraJM5Ksb>*p^*%uKpV zKNw;!XK_rbZ*hpzI*EmiT;d#$8D?E*uqNhhy;j*EK2uN7(rq+(;?eBMK**De1D^RfVy+i+a2!JBd;-jZAJw)_U(kx$@+d=~G@7x7p5 zI^L7-;FRLQ`-+9XDZPch8)uY3IIE1rhsrpiQ*mBN$H&T}xS-5NyYf?9RPyi-r5Kl# zGJK*09ek=(;h#!1E-SUTqBP>F(u!-!F?^=Hi_ewQxUPJNe=8SoL%E6$EvBumV1&AkeswP+)iy?{ z=h!2t-eFHoV=pa^y|vNoqus}7Z8H06IgHT?7|@onpSG5<+AhXvhj_Pkgz?(jOwcZ{ zzjliQyb=d{Z4U7cX0kVxL%p*&%v;11?;3v3TftG@9USeg=e^!nIM#cT0Dol;W|=vf ztIP>pZBFNN<`Z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(hBYG4~aR?Bfs zt-^Kn0RE*OMyq-PpQx|n-|D;gRDBSb$v_}!t@@Q+z=+mBJS8W~rS~bJ8;|$j>u$$J#?g3q4gdWYi z^r7sbk7lGki9PjsjM5h~T3^8!eJx}4O7_wl*;_xxKKg0K=^wJMeuMoymdsWnY zMxWuLZ5T{9BKWY8!VDvanZ^=k8LRn-v6=IY<6K}|<739B{F$jT+YD!}8Oc0z0+*UU z4lv)G%K~#Tmznu|(p<&m=4P%igIr}EXOZ~{ zb|9QVJBqn>0{7ZOxzGMC_uFH5z)s;oJC!x|Oo8VLZUO70}Fv(aA3Cc8x7je^_C zSM3TOvG?$(UCU#31Al8D{DnYm zNDFbYYa_07qAhrjr6Ny}hG9SlC(V<>I*?MqX2gnUKvC`>Hk7EUz0s=^O=Kt1mby20 zlxQp5#T|lXgsW=@XVr*XGh||q#-I+)9*5{oF8fO^_Y00&MStgT{~fG{tb)#&xG@ZO zjJ^w*=q&FW6X<;l8DZiY?SUg=0R2Vw-7D{4d(;>Ofi*>R+y zDk#8O^>5cc1_lPpg&f=fG`k#8O^>5cc1_lO`g&f=fG^zz{ diff --git a/bin/Hintergrund.class b/bin/Hintergrund.class index 10d6ae654162d307bb4a029f83a31cd848ee8e05..e25986c7cd6a3899653e6feec2ae84e43f14c0c0 100644 GIT binary patch delta 17 YcmeBT?qcRR^>5cc1_lPpjT}vk06Ap^*Z=?k delta 17 YcmeBT?qcRR^>5cc1_lO`jT}vk069zr(*OVf diff --git a/bin/Lives.class b/bin/Lives.class index 00ef1162bdb457b0ed92a93124b09ee5fdab4c5d..4ea4f45510b89d23fb76829c71c22f2b11f0a335 100644 GIT binary patch delta 17 Zcmcb>bb*QE)W2Q(7#J8VH*$C|0suji1}Fdk delta 17 Zcmcb>bb*QE)W2Q(7#J8#Hgb3{0sujJ1|t9f diff --git a/bin/Main.class b/bin/Main.class index 084339fa64c10c5228200fabc70fb3480b1b91fd..f731d3f43f1f931e5c54faff6119d7c321041a47 100644 GIT binary patch liter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ZcmX>jc1Dcj)W2Q(7#J8VH*&ae0{}y922KC~ delta 17 ZcmX>jc1Dcj)W2Q(7#J8#HgdRd0{}x*21x(_ diff --git a/bin/MapMenu$1.class b/bin/MapMenu$1.class new file mode 100644 index 0000000000000000000000000000000000000000..499879e3665cbbb67f5191a1d620048460a292b5 GIT binary patch literal 784 zcmaJ_7!!k42rZgG`f8@j2#aO5*_~GZkEb7y}3`u+pJQ?y;=1d4q*?khd1Z@O><%BONFJ0q!& zJ8y=kDlje<1ZpWNKbnr3Ds4J10ux5M7bZq&6$>nwlQ5}2CR;C~+amZZ)S-DU;5X)I zb0FYsM@Om%fh8X<3Lf$(`6!|+kZ;(8QZLkMe{wcd@u3`!lt85y1#&cyacJWVbZk?B z#XscrO*SpbRN7k=zmMWGbtJIf=>1cD*E-p14m_;lhKuV0Zl>MGO;iP{!-+AGem65a zXY^3Rx{F%^D}QIz{S>INor#YPYos)eLv0R>3_cvjGN6ULni_$%|7j5rOuRZvNv~i| zOJ_?d8zpA;y@O~H2kKR52jpkcA6ZFk-_^k=Nki7mIjz;9pR+GiB{4==EGo|Y8Yrp5$ISb@X+HD&COa2I9lrQ{nkf{dJ0 uxQ#ok_L+YdbvC%iI=<*V7d40AeTF$aK!bmWS6o7qC+o>7wqJ`Yht=Q9PNJ*; literal 0 HcmV?d00001 diff --git a/bin/MapMenu.class b/bin/MapMenu.class index 66a3feb472b136f6f0f9c1bdcb38ec0af55898aa..a1f816da2ce6a6fe5cc1439c9623463088cdd332 100644 GIT binary patch delta 74 zcmeB`SSrDF>ff$?3=9mG3}-iTE#}~5WZ?EoEiUm*%}q)z+PsFtgISrG;UrK26T>Nn U(?FVwfsvsTNQ1x`AZ7va0W9MYN&o-= delta 50 zcmZ1~(JR4q>ff$?3=9k=3}-fSE#}y~o5P)1l8NCYP>6})6vJsC&BegT&5cc1_lPpjU4r?06Fso;{X5v delta 17 YcmZqYZs+DW^>5cc1_lO`jU4r?06E$P-T(jq diff --git a/bin/Player.class b/bin/Player.class index 30a6317f9fac60a03f2ae7a8117841b5f196afbd..cdeb01b3c2e1d40a7ea70e142269f8d6fc31503f 100644 GIT binary patch delta 42 tcmeyX_*aqR)W2Q(7#J8VH*$3FGH#nZkyjN+Zs*kllFvZw%{+V`nE-P|5H0`! delta 42 tcmeyX_*aqR)W2Q(7#J8#Hga_EGH#zdkyjN+Zs*kllFvZw%{+V`nE-O@5G?=z diff --git a/bin/Point.class b/bin/Point.class index c3665100b051335181c293b55e347e6a5994a0af..8be2f7a1f67e37435136adf1602e4faa71cbe644 100644 GIT binary patch delta 17 ZcmX@ae2AIj)W2Q(7#J8VH*)M^1OPzQ27mwn delta 17 ZcmX@ae2AIj)W2Q(7#J8#HgfD@1OPz1273Si diff --git a/bin/Portal.class b/bin/Portal.class index 1eaeaf93172d1466320cda5915b3d988546196d0..be456d5791c24ac393be46ffdb9861982f972bda 100644 GIT binary patch delta 17 ZcmX@ce2kgn)W2Q(7#J8VH*)M_1OP!@28;jz delta 17 ZcmX@ce2kgn)W2Q(7#J8#HgfD^1OP!q28RFu diff --git a/src/Game.java b/src/Game.java index 1df99ed..0e3e19c 100644 --- a/src/Game.java +++ b/src/Game.java @@ -145,7 +145,7 @@ public class Game { delay(1000); frame.setVisible(true); - while (true) { // Main-Loop + while (player.lives > 0) { // Main-Loop dt = System.nanoTime() - lastT; // delta time lastT = System.nanoTime(); // delta time @@ -403,7 +403,8 @@ public class Game { liveLabels[player.lives].setBounds(0, 0, 0, 0); // Das herz wird "entfernt" if (player.lives == 0) { // Wenn der Spieler keine Leben mehr übrig hat - System.exit(0); // Das Programm wird beendet + fpsLabel.setText("YOU LOST"); + delay(3000); } delay(200); // Damit nicht sofort wieder alle losgeht @@ -444,7 +445,6 @@ public class Game { if (empty) { fpsLabel.setText("YOU WON"); delay(5000); - System.exit(0); // Das Programm wird beendet // HIER DEN HIGHSCORE IMPLEMENTIEREN } } @@ -472,7 +472,7 @@ public class Game { } // Methode zum verzögern (warten) in ms - public void delay(int time) { + private void delay(int time) { try { Thread.sleep(time); diff --git a/src/Main.java b/src/Main.java index da3e939..331efa5 100644 --- a/src/Main.java +++ b/src/Main.java @@ -3,29 +3,49 @@ // Muss ausgeführt werden zum Starten public class Main { + + static - @SuppressWarnings("unused") // Die "unused" - Warnungen werden in dieser Datei nicht mehr angezeigt + MapMenu menu; + + static Game game; public static void main(String[] args) { System.setProperty("sun.java2d.opengl", "true"); - MapMenu menu = new MapMenu(); - - while(!menu.rdy) { - delay(1); + menu = new MapMenu(); + + while (!menu.rdy) { + delay(100); } - - Game game = new Game(menu.selectedMap + ".txt"); - - } - - // Methode zum verzögern (warten) in ms - public static void delay(int time) { - try { - Thread.sleep(time); - } catch (InterruptedException e) { - e.printStackTrace(); + + game = new Game(menu.selectedMap + ".txt"); + + while (true) { + + game.frame.dispose(); + + menu = null; + game = null; + + menu = new MapMenu(); + + while (!menu.rdy) { + delay(100); } + + game = new Game(menu.selectedMap + ".txt"); } + + } + + // Methode zum verzögern (warten) in ms + public static void delay(int time) { + try { + Thread.sleep(time); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } } \ No newline at end of file