From 8f45f0cba3660888db304fbae54490159d4216d1 Mon Sep 17 00:00:00 2001 From: Lenz Date: Mon, 8 Jun 2020 18:49:02 +0200 Subject: [PATCH] =?UTF-8?q?aalles=20m=C3=B6gliche=20ll?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Blinky.png | Bin 577 -> 0 bytes assets/Clyde.png | Bin 359 -> 0 bytes assets/Geister/Blinky.png | Bin 0 -> 317 bytes assets/Geister/Clyde.png | Bin 0 -> 283 bytes assets/Geister/Inky.png | Bin 0 -> 282 bytes assets/Geister/Pinky.png | Bin 0 -> 273 bytes assets/Geister/feared.png | Bin 0 -> 270 bytes assets/Inky.png | Bin 413 -> 0 bytes assets/Maps/TestMap.txt | 19 +++ assets/{ => Pac-Man}/Pacman_Down.png | Bin assets/{ => Pac-Man}/Pacman_Down1.png | Bin assets/{ => Pac-Man}/Pacman_Down3.png | Bin assets/{ => Pac-Man}/Pacman_Left.png | Bin assets/{ => Pac-Man}/Pacman_Left1.png | Bin assets/{ => Pac-Man}/Pacman_Left3.png | Bin assets/{ => Pac-Man}/Pacman_Right.png | Bin assets/{ => Pac-Man}/Pacman_Right1.png | Bin assets/{ => Pac-Man}/Pacman_Right3.png | Bin assets/{ => Pac-Man}/Pacman_Up.png | Bin assets/{ => Pac-Man}/Pacman_Up1.png | Bin assets/{ => Pac-Man}/Pacman_Up3.png | Bin assets/Pinky.png | Bin 776 -> 0 bytes assets/cursed.png | Bin 260 -> 0 bytes assets/feared.png | Bin 256 -> 0 bytes bin/Game.class | Bin 9735 -> 9782 bytes bin/Ghost.class | Bin 2792 -> 2824 bytes bin/Main.class | Bin 1327 -> 1327 bytes bin/Map.class | Bin 2892 -> 2892 bytes bin/MapMenu.class | Bin 3015 -> 3039 bytes bin/Player.class | Bin 4253 -> 4349 bytes src/Game.java | 164 ++++++++++++------------- src/Ghost.java | 10 +- src/Player.java | 48 ++++---- 33 files changed, 126 insertions(+), 115 deletions(-) delete mode 100644 assets/Blinky.png delete mode 100644 assets/Clyde.png create mode 100644 assets/Geister/Blinky.png create mode 100644 assets/Geister/Clyde.png create mode 100644 assets/Geister/Inky.png create mode 100644 assets/Geister/Pinky.png create mode 100644 assets/Geister/feared.png delete mode 100644 assets/Inky.png create mode 100644 assets/Maps/TestMap.txt rename assets/{ => Pac-Man}/Pacman_Down.png (100%) rename assets/{ => Pac-Man}/Pacman_Down1.png (100%) rename assets/{ => Pac-Man}/Pacman_Down3.png (100%) rename assets/{ => Pac-Man}/Pacman_Left.png (100%) rename assets/{ => Pac-Man}/Pacman_Left1.png (100%) rename assets/{ => Pac-Man}/Pacman_Left3.png (100%) rename assets/{ => Pac-Man}/Pacman_Right.png (100%) rename assets/{ => Pac-Man}/Pacman_Right1.png (100%) rename assets/{ => Pac-Man}/Pacman_Right3.png (100%) rename assets/{ => Pac-Man}/Pacman_Up.png (100%) rename assets/{ => Pac-Man}/Pacman_Up1.png (100%) rename assets/{ => Pac-Man}/Pacman_Up3.png (100%) delete mode 100644 assets/Pinky.png delete mode 100644 assets/cursed.png delete mode 100644 assets/feared.png diff --git a/assets/Blinky.png b/assets/Blinky.png deleted file mode 100644 index e9668b11551650737512593078ac55afb83a91bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 577 zcmV-H0>1r;P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf0oF-GK~y+TtyH^8 z15ps24SA9T4Hgm$i-=$>LT!5D*08qp}mVh)B{% zd=V2R@2r|}?&fYbo87nx=D^|Zo|!q!-5FLuMCc~kGjt2uq#O$TNd*%>TSL!`5OtVw z)8f{|T6fsONQ0(MwH-2}cFhPWmpWHvcxm&hjRGNnwJ?Cy$%Q72OhezoI)pqEN*%j$ zoh~{WDI=X#>x@$~i04tnvs1)=A0AsQEb|XTJ;uwaTUnTYo`a=FzZ5bwe0UY%`mO-?H+ilopcR4GZ3)5& zD->SrlBO88m~639rH<&K$6XT`tly-Sp<1Pq><@t53ggJF*u5n-em|KqDtT>ec^k1* zs>SI&Qy@ zv;rTr3Q32e$&8Vfr`RFo)OB88Pii!iDN<3Sv5516v=j4yO5Zhk$q?`tj-!ZQeud93 P00000NkvXXu0mjf47Kt= diff --git a/assets/Clyde.png b/assets/Clyde.png deleted file mode 100644 index 4974ec315502cfef1781c2cdddba3d3693eb96d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 359 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`j_{Y=5F~q_@`Op9V_ROY?g=}fYNm{dh%@;i7 z#Mr`nBu&D|!FUFzS2EKC#}=N$Oa`$YZHgz>xs)newly+Lvbz(<)_8(d;kKfQB7>>O z)zc^RSR`9``p%^%L`-8zJgj5TpOjGXx2thsDBB_SD%t(qjt@>awO!z2YrAl`Gk{TJ zLuY!zj-ay#3iA0w7`PntS{~~tupSN&xb*M;ew7K_hYEJ4zdu;yYJA~ILz+TNhn%9r z^v1oNyc_-|Cj9uwe9Dov!{CV6;lR%i;$r_wcpqzMefo)ogO}w8uL`q3pNP=G6^#K6 zYu7M$J`{3in!zS?$;CnLs)Li%MaDKMHa3P8{Zlq&O~|PQh697AtDnm{r-UW|ei426 diff --git a/assets/Geister/Blinky.png b/assets/Geister/Blinky.png new file mode 100644 index 0000000000000000000000000000000000000000..6f70670eb325857377a83f4f17580325e5b5626f GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`jc*)bnF~q|E>Xd_ghZK0)q8}f1nRjsU`~MbI zpC!{C9cB4$d}>!vz~;&i{!$T*{qORbj!R^Ezx}jhW*vLVGm-328Zs+^CfioHrr8G;xO4mqw=M5A4mFBH1UDO-e%cpT5P%d-Z4Kyoi16 zMcHxIb1yq=&)#QW<`7LupzJB@>=G4W-3s!7g{{L2u?jmvVi;0u@qpR$JzGLuo L^>bP0l+XkK?Qwq6 literal 0 HcmV?d00001 diff --git a/assets/Geister/Clyde.png b/assets/Geister/Clyde.png new file mode 100644 index 0000000000000000000000000000000000000000..dc9155afe59a664239b10c4e4517ddb3cce0177b GIT binary patch literal 283 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`jxWUuKF~q|E?No2R76qQRmv3yFPwzZ&=h){8 zi|O+YZhaZR7+f#6ui*J~lLSqBU+)PsZeDrv_;{9$x`#{m-PE-UJ5pcYyjZsI`HLqL ze0FMTv@~q!c$U3GUG2q;V@qd(5T*VXbfFyZV7={Q@R=hM#^v8@42H_~b;KJQDJc cRpK-Ir{i8T-WGIn0^QEw>FVdQ&MBb@0E&NdcmMzZ literal 0 HcmV?d00001 diff --git a/assets/Geister/Inky.png b/assets/Geister/Inky.png new file mode 100644 index 0000000000000000000000000000000000000000..1926aa30c230d5761dde174be05655f28dc23693 GIT binary patch literal 282 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`jxZcynF~q|E?NmphLkc{u2lu8Iy!_jLd1)NW z&jaqiIJfle_!a`5 zDk9qUqM*$^DPel?S>0Jpxk^0VGYfTX_C7WH+%k8|8Ocpr<$2%t*lpjF^=IQlk7cg| z>L2pFow?3gbV+cuMuyF=lXK1qD0m+|pi!ssL$m&%`5sfI`(2`&lemm7S~<8`cF$*c Z9>;jZO3R6N3nS3!44$rjF6*2UngCEuY19A! literal 0 HcmV?d00001 diff --git a/assets/Geister/Pinky.png b/assets/Geister/Pinky.png new file mode 100644 index 0000000000000000000000000000000000000000..331a22448f16a3b55bc1f4620b0ef33c5934e675 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`jxXjbVF~q|E?bO|T4GKK22TvZoc=O`_|9bA? z;>{}qg7o~A^X9cI*ebKZH$*x)#GlQ){IT`IYro|3KbopUZkzX5%+BIjM!KEPPE8Fb z2cJtdyxB%h&wRdhWG?ivNwXH{JACY^o_FBiUu9EU`%bP0l+XkKSaD*o literal 0 HcmV?d00001 diff --git a/assets/Geister/feared.png b/assets/Geister/feared.png new file mode 100644 index 0000000000000000000000000000000000000000..677737995773904f07d02c14c4379ef0138c8dcd GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`jxY*OhF~q`u@04gE2Lm2g;s4hX|DWE-cVA5< zCOGp|jDN}UH)k!*Bx=Mx`It0S zthz!ixXkoz(UE`(SGJnmvs2ENYR&nbqO2OV*wO8*vhcm1F%#aM460KKnNV?7PU=5* zEkmLL=TW(&%QohEXV$j=Z*5{)@Hr!Q?_G{ojUKaxptBF}KeKZY{+Juyky*EI3(&a? Mp00i_>zopr0GZ2W%>V!Z literal 0 HcmV?d00001 diff --git a/assets/Inky.png b/assets/Inky.png deleted file mode 100644 index 9383ed565dd9d1ddd47a87e2bc7934b50fcb4849..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 413 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<|3!N}9aF~q_@`Op9V_ROY?foyH-QV#@dv6|5+ zc*=#5h4)CBgpq^!3{J0Ph6#=>Jcro~Vm$g3Ppoq(RNR&L{+*+N9mAyZcWy77f&4~? z*@_SDrng=AyC;B;spEg6(Sigo3ufhW1})NTOip_={#^BYFBv9%FLj2{m)VJ3Z-ZB8 zuskpkU|W_`c{m}YrrmM#W77~8jyi^BAJ3T&<%PMM!(OYm9e=*gQMJS1!?o^s9{pb- z5_Vx-PObtB5^+58%QB7Tyt~xYr6Ad%UAF)4ANEv5Mze$me}5eO@LqnISjCbAV*$Cm z{riks@}9L7DKLoat}d=OFeoT!_;QFbj=7Ujp}BR+0vQDbiMAGoO^FH)8yjCFbVzl~ zxtYkI(&jC5iiMennKM&Kr9VkQvG)Z-FfTJR!|BN Bl1%^r diff --git a/assets/Maps/TestMap.txt b/assets/Maps/TestMap.txt new file mode 100644 index 0000000..a5551bf --- /dev/null +++ b/assets/Maps/TestMap.txt @@ -0,0 +1,19 @@ +######### +#L0123,,# +######### +######### +############## +#,,,,,. # +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,P,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,# +#,,,,,,,,,,,,R +############## \ No newline at end of file diff --git a/assets/Pacman_Down.png b/assets/Pac-Man/Pacman_Down.png similarity index 100% rename from assets/Pacman_Down.png rename to assets/Pac-Man/Pacman_Down.png diff --git a/assets/Pacman_Down1.png b/assets/Pac-Man/Pacman_Down1.png similarity index 100% rename from assets/Pacman_Down1.png rename to assets/Pac-Man/Pacman_Down1.png diff --git a/assets/Pacman_Down3.png b/assets/Pac-Man/Pacman_Down3.png similarity index 100% rename from assets/Pacman_Down3.png rename to assets/Pac-Man/Pacman_Down3.png diff --git a/assets/Pacman_Left.png b/assets/Pac-Man/Pacman_Left.png similarity index 100% rename from assets/Pacman_Left.png rename to assets/Pac-Man/Pacman_Left.png diff --git a/assets/Pacman_Left1.png b/assets/Pac-Man/Pacman_Left1.png similarity index 100% rename from assets/Pacman_Left1.png rename to assets/Pac-Man/Pacman_Left1.png diff --git a/assets/Pacman_Left3.png b/assets/Pac-Man/Pacman_Left3.png similarity index 100% rename from assets/Pacman_Left3.png rename to assets/Pac-Man/Pacman_Left3.png diff --git a/assets/Pacman_Right.png b/assets/Pac-Man/Pacman_Right.png similarity index 100% rename from assets/Pacman_Right.png rename to assets/Pac-Man/Pacman_Right.png diff --git a/assets/Pacman_Right1.png b/assets/Pac-Man/Pacman_Right1.png similarity index 100% rename from assets/Pacman_Right1.png rename to assets/Pac-Man/Pacman_Right1.png diff --git a/assets/Pacman_Right3.png b/assets/Pac-Man/Pacman_Right3.png similarity index 100% rename from assets/Pacman_Right3.png rename to assets/Pac-Man/Pacman_Right3.png diff --git a/assets/Pacman_Up.png b/assets/Pac-Man/Pacman_Up.png similarity index 100% rename from assets/Pacman_Up.png rename to assets/Pac-Man/Pacman_Up.png diff --git a/assets/Pacman_Up1.png b/assets/Pac-Man/Pacman_Up1.png similarity index 100% rename from assets/Pacman_Up1.png rename to assets/Pac-Man/Pacman_Up1.png diff --git a/assets/Pacman_Up3.png b/assets/Pac-Man/Pacman_Up3.png similarity index 100% rename from assets/Pacman_Up3.png rename to assets/Pac-Man/Pacman_Up3.png diff --git a/assets/Pinky.png b/assets/Pinky.png deleted file mode 100644 index b3102c69f2602153d92acc33d0a7bce62f3c4f19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 776 zcmV+j1NZ!iP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf0-Z@jK~y+TtyD{B z6HydBFP~1V6c<*y6hy@$sE8m1D}tgc1+nSIjdi0giueI7;;#!8T$qX=T}1@lv?`Q} zpyCHar65*=VngZ9()y{kO!h>3lvms3{2C>(mXK_qP2*|to8L0 z;aP&6s!<=pT6Z-?lX!p@5uym*MnOIjFNl^1o>!Z6GgeTpma7R8O?;j&{G0?j9+8u* z(hSu}F4AL{PxY+V=uy_c+VO z7`k8eph-VtfhkxpwDQ`b^_ELq&VjmPjPKLhwq3%s^YpiKaV%x=09Pb!3T$!LVYsE;8%;0?@jV~Wk$d!dzFAVgj@G>!p z>{rWhzMwkA`nj1|A?Hp^W%9ruI!kI`2i?c(YRoM!<)7d#kt*z{UP+CE+HZ{0VR%T*VBlaSm_T6ZwNIb~%M%IgUEUV--_3@sXT} z@{F4wLre|JF*S*l2!?SFpU|$~Njm64!muKk1!vKP5vO1hW4MLShKpkW{Twrk8x#pz zJf)9~m>{a3xV|zU>>+4YL2fw2zxE3gI-~p42HmZ~2;nby;~;RC_;0`f0000NS%G}c0*}aI1_r((Aj~*bn@<`jIMdU`F~q`u@05#t4GJ8tTibu_x7+f6wYac4 zFN?D5>l|NW%fxc+WmB5e=eOM6)$RMd^oUjJ3@2Z=%%k42tO}b_q!t~PbP0l+XkK DHhEu* diff --git a/assets/feared.png b/assets/feared.png deleted file mode 100644 index 8f710d3c35ad118156da3e9a05bcc58e993ee6ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0*}aI1_r((Aj~*bn@<`jIMvg|F~q`u?-WM91_ch+jm;(hi%SKW)OlHz zWnbs&F0M$dU#*~&^2sy8&w&3S>r!27r-ka5dmb&G%d69sBA0eZwsYR5*#+*$UhI20 zEnF~jRscuqm)chgKV~`oYVkj{yD`J!?G?_-75|+hQ!SrvZ<(2?amnSYSBdVDWoLFo yFWWx5UiNz0*KKPg60eBdecuxJxTBWs0h{ad;N2Dpw?csqWbkzLb6Mw<&;$Sg=3T7- diff --git a/bin/Game.class b/bin/Game.class index effacc3d0195df284d40c5c751046382f1cacaa4..e00d09613a915e90cb2b8f6d2e9d297ca25b4f6f 100644 GIT binary patch literal 9782 zcma)C34B!5)&HM)Z|2SNGBeo#LH5NY2vJZ(Kz0Iwut*{hK*=OC2?NPYoJ=6Wx<`ve zrS1li0%D_8QDZWwxK%%crBQU?Zq=19c${D#5=l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xIWZkQ$RcgLtnV1JANntm%$q6z diff --git a/bin/Ghost.class b/bin/Ghost.class index 376c1e89b705db05516f6e16b947e5cad16a67f9..697b081ddcccd57ea86ebd42482e56e210179f94 100644 GIT binary patch delta 78 zcmaDM+9Aeq>ff$?3=9mG8#xRZIeFbvGmA@7i}WX3GDdUq!Ff{|m8E%LJkPxBN)84~ NMh3X*&4(FPIRWYz7-j$f delta 46 zcmeAWdm+kk>ff$?3=9k=8#xRZ8CfSgGDb79Ojc1Dcj)W2Q(7#J8VH*&ae0{}y922KC~ delta 17 ZcmX>jc1Dcj)W2Q(7#J8#HgdRd0{}x*21x(_ diff --git a/bin/MapMenu.class b/bin/MapMenu.class index 1d6814f611e5667368ec96aaea39e8f6d3c2ea4c..b1f4684edafcba58c489242bbc906766f4649be0 100644 GIT binary patch delta 55 zcmX>ueqWsH)W2Q(7#J8V8BT2Es^H*dWZ?EoEiUm*%}q)z+T6&Y%go3;c|ErT7sGL& KDi#JthBg2O4-c0B delta 30 mcmcaFeq5aE)W2Q(7#J8#7>;k`s^Hi>fkTIxk!kW?ZV3Rl?g~W! diff --git a/bin/Player.class b/bin/Player.class index c8abab71b10c9ea27ca3e706bbdb8f5a242f119c..cdeb01b3c2e1d40a7ea70e142269f8d6fc31503f 100644 GIT binary patch delta 888 zcmZ{ic}&k?9LHau=SltW(@L6^g=VBki_G|=IkF{3M2>7MKV7C%t#b4mxrR!w2<1t z@?QO2T7E8pPOsmg8B^oa=1xdR%(hV^{Gt8{hS(?(yjvkLDM`uMp*BkY6B)`9y0)TX zGYnGZ6g=AmHp<&OZ|YREy;nqfZknmIO=$g;Ux|$!?IS}39g&h%+w9`o!5PDOVyS03 zSDC>LW^#)-?lGH(%;PH#zB6Am3DSi`8Ag&!AX%oEy*M1=AXOHSCh4S0HW`vnrWBAR zg)EY_WJ?h_vWZ+NBTp*Hmt8EDDwfD0mP!rFq|V85xyK5*PoXrjQr@ykb!D{*V2v6` zp&H5x70w1VmLe5Jv5KZdO=F{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29,7 @@ public class Game { private JLabel fpsLabel; private JLabel liveLabels[]; - private int delaytimer = 4; + private long delaytimer = 4000; @SuppressWarnings("unused") private long fps = 60; @@ -46,6 +46,8 @@ public class Game { int minn; int[] HCost = new int[4]; + boolean empty; // Für die Überprüfung, ob alle points weg sind, benötigt + public Game(String selectedMap) { // Erstellen des Konstruktors (Was soll passieren, sobald dieses Klasse // aufgerufen wird?) @@ -65,7 +67,7 @@ public class Game { for (int i = 0; i < liveLabels.length; i++) { liveLabels[i] = new Lives(); panel.add(liveLabels[i]); - liveLabels[i].setBounds(710 + 20 * i, 35 , 20, 20); + liveLabels[i].setBounds(710 + 20 * i, 35, 20, 20); } scoreLabel = new JLabel(Integer.toString(score)); @@ -74,14 +76,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); - + + fpsLabel.setFont(new Font("Consolas", Font.BOLD, 15)); + 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 @@ -112,31 +114,22 @@ public class Game { player.setBounds(player.getPos('x', 0), player.getPos('y', 0), 20, 20); // Pac-Man wird das erste Mal gerendert - for (int i = 0; i < 35; i++) { // für jeden Brick - for (int j = 0; j < 35; j++) { // für jeden Brick + for (int i = 0; i < 35; i++) { // für die ganze Map + for (int j = 0; j < 35; j++) { // für die ganze Map if (Map.bricks[j][i] != null) { // Damit kein Fehler auftritt wegen nicht vorhandenen Bricks panel.add(Map.bricks[j][i]); // Der jeweilige Brick wird zum panel hinzugefügt - Map.bricks[j][i].setBounds(Map.bricks[j][i].xPos, Map.bricks[j][i].yPos, 20, 20); // Rendern des - + // Rendern des Bricks: + Map.bricks[j][i].setBounds(Map.bricks[j][i].xPos, Map.bricks[j][i].yPos, 20, 20); } - } - } - for (int i = 0; i < 35; i++) { // für jeden Brick // points - for (int j = 0; j < 35; j++) { // für jeden Brick - if (Map.points[j][i] != null) { // Damit kein Fehler auftritt wegen nicht vorhandenen Bricks - panel.add(Map.points[j][i]); // Der jeweilige Brick wird zum panel hinzugefügt - Map.points[j][i].setBounds(Map.points[j][i].xPos, Map.points[j][i].yPos, 20, 20); // Rendern des + // Analog für die points und die BigPoints: + if (Map.bigpoints[j][i] != null) { + panel.add(Map.bigpoints[j][i]); + Map.bigpoints[j][i].setBounds(Map.bigpoints[j][i].xPos, Map.bigpoints[j][i].yPos, 20, 20); } - } - } - for (int i = 0; i < 35; i++) { // für jeden Brick // points - for (int j = 0; j < 35; j++) { // für jeden Brick - if (Map.bigpoints[j][i] != null) { // Damit kein Fehler auftritt wegen nicht vorhandenen Bricks - panel.add(Map.bigpoints[j][i]); // Der jeweilige Brick wird zum panel hinzugefügt - Map.bigpoints[j][i].setBounds(Map.bigpoints[j][i].xPos, Map.bigpoints[j][i].yPos, 20, 20); // Rendern - // des - + if (Map.points[j][i] != null) { + panel.add(Map.points[j][i]); + Map.points[j][i].setBounds(Map.points[j][i].xPos, Map.points[j][i].yPos, 20, 20); } } } @@ -152,19 +145,16 @@ public class Game { delay(1000); frame.setVisible(true); - // ----------------------------------------------------------------------------------------------------------------------------------------------------- - // ----------------------------------------------------------------------------------------------------------------------------------------------------- - // ----------------------------------------------------------------------------------------------------------------------------------------------------- - // ----------------------------------------------------------------------------------------------------------------------------------------------------- - // ----------------------------------------------------------------------------------------------------------------------------------------------------- - // ----------------------------------------------------------------------------------------------------------------------------------------------------- + while (true) { // Main-Loop - while (true) { // Hauptschleife + dt = System.nanoTime() - lastT; // delta time + lastT = System.nanoTime(); // delta time + + player.setLocation(player.getPos('x', dt), player.getPos('y', dt)); if (ghosts[0].feared == true) { if (Ghost.fearedTimer != 0) { Ghost.fearedTimer--; - } else { for (int i = 0; i < ghosts.length; i++) { ghosts[i].feared = false; @@ -173,10 +163,6 @@ public class Game { } } } - dt = System.nanoTime() - lastT; // delta time - lastT = System.nanoTime(); // delta time - - player.setLocation(player.getPos('x', dt), player.getPos('y', dt)); for (int i = 0; i < ghosts.length; i++) { if (!ghosts[i].getIsDead()) { @@ -341,7 +327,7 @@ public class Game { for (i = 0; i < 4; i++) { ghosts[i].feared = true; Ghost.fearedTimer = 1000; - ghosts[i].changeSauce("feared"); + ghosts[i].changeSauce("Geister/feared"); if (ghosts[i].left) { ghosts[i].dire = 0; } else if (ghosts[i].right) { @@ -363,38 +349,32 @@ public class Game { } } - if (Map.Left != null) { + // Kollision von Pac-Man mit den Portalen: + if (Map.Left != null && Map.Right != null) { if (player.getPos('x', 0) < Map.Left.xPos + 20 && player.getPos('x', 0) > Map.Left.xPos - 20 - && player.getPos('y', 0) < Map.Left.yPos + 20 && player.getPos('y', 0) > Map.Left.yPos - 20) { + && player.getPos('y', 0) < Map.Left.yPos + 20 && player.getPos('y', 0) > Map.Left.yPos - 20 + && Map.Right != null) { + player.xPos = Map.Right.xPos - 20; + player.yPos = Map.Right.yPos; - if (Map.Right != null) { - player.xPos = Map.Right.xPos - 20; - player.yPos = Map.Right.yPos; + } else if (player.getPos('x', 0) < Map.Right.xPos + 20 && player.getPos('x', 0) > Map.Right.xPos - 20 + && player.getPos('y', 0) < Map.Right.yPos + 20 && player.getPos('y', 0) > Map.Right.yPos - 20 + && Map.Left != null) { + player.xPos = Map.Left.xPos + 20; + player.yPos = Map.Left.yPos; - } - } - } - if (Map.Right != null) { - if (player.getPos('x', 0) < Map.Right.xPos + 20 && player.getPos('x', 0) > Map.Right.xPos - 20 - && player.getPos('y', 0) < Map.Right.yPos + 20 && player.getPos('y', 0) > Map.Right.yPos - 20) { - - if (Map.Left != null) { - player.xPos = Map.Left.xPos + 20; - player.yPos = Map.Left.yPos; - - } } } - - // Geister LOOP for (int i = 0; i < ghosts.length; i++) { - // + + ghosts[i].setLocation(ghosts[i].getPos('x', dt), ghosts[i].getPos('y', dt)); // Setzen der Positionen + // der Geister + 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]); @@ -403,31 +383,38 @@ public class Game { } } - ghosts[i].setLocation(ghosts[i].getPos('x', dt), ghosts[i].getPos('y', dt)); + // Kollision der Geister mit Pac-Man: if (player.getPos('x', 0) < ghosts[i].getPos('x', 0) + 18 && player.getPos('x', 0) > ghosts[i].getPos('x', 0) - 18 && player.getPos('y', 0) < ghosts[i].getPos('y', 0) + 14 && player.getPos('y', 0) > ghosts[i].getPos('y', 0) - 14) - if (ghosts[0].feared) { + if (ghosts[i].feared) { ghosts[i].setIsDead(true); - ghosts[i].setDeathTimer(1000); + ghosts[i].setDeathTimer(1500); ghosts[i].setPos('x', -100); ghosts[i].setPos('y', -100); score += 1000; + scoreLabel.setText(Integer.toString(score)); } else { + player.lives--; - liveLabels[player.lives].setBounds(0, 0, 0, 0); - if (player.lives == 0) { - System.exit(0); + 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 } - delay(200); + delay(200); // Damit nicht sofort wieder alle losgeht + + // Die Positionen der Geister werden zurückgesetzt for (int j = 0; j < ghosts.length; j++) { ghosts[j].setPos('x', Map.ghost_posX[j]); ghosts[j].setPos('y', Map.ghost_posY[j]); } + + // Die Position von Pac-Man wird zurückgesetzt, und er bewegt sich nicht mehr. player.setPos('x', Map.pac_posX); player.setPos('y', Map.pac_posY); player.up = false; @@ -436,15 +423,10 @@ public class Game { player.left = false; } - // Geister LOOP - } - // - + } // Ende vom Geister Loop - // Ein delay zum Ende der Hauptschleife - - if (frames % 100 == 0) { - boolean empty = true; + if (frames % 100 == 0) { // Das folgende soll nur alle 100 frames überprüft werden: + empty = true; for (int i = 0; i < 35; i++) { for (int j = 0; j < 35; j++) { if (Map.points[j][i] != null) { @@ -460,27 +442,39 @@ public class Game { } } if (empty) { - scoreLabel.setText("YOU WON"); - delay(1000); - System.exit(0); // HIER DEN HIGHSCORE IMPLEMENTIEREN + fpsLabel.setText("YOU WON"); + delay(5000); + System.exit(0); // Das Programm wird beendet + // 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)); + + fpsLabel.setText("fps: " + Integer.toString((int) fps)); // Refreshen vom fpsLabel frames++; // FRAMES WIRD HOCHGESETZT - delay(delaytimer); - // + + if (frames % 15 == 0) { + fps = 1000000000 / dt; // Berechnen der fps + if (frames > 100) { + if (fps > 200) { + delaytimer += 100; + } else if (fps < 180) { + delaytimer -= 100; + } + } + } + delay(delaytimer); // delay ist wichtig, um die geschwindigkeit der objekte und die fps zu + // kontrollieren } - // ENDE DER WHILE-SCHLEIFE + // ENDE DES MAIN-LOOPS } // Methode zum verzögern (warten) in ms - public void delay(int time) { + public void delay(long time) { try { - Thread.sleep(time); + Thread.sleep(0, (int) time); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/src/Ghost.java b/src/Ghost.java index 1aa7fdf..bafb9c1 100644 --- a/src/Ghost.java +++ b/src/Ghost.java @@ -24,7 +24,7 @@ public class Ghost extends Picture { // Die public Ghost(int type) { - super("Pinky"); // Aufrufen der übergeordneten Klasse + super("Geister/Pinky"); // Aufrufen der übergeordneten Klasse this.type = type; // xPos = 150 + 40 * index; @@ -33,13 +33,13 @@ public class Ghost extends Picture { // Die public void ogSauce() { if (type == 0) { - this.changeSauce("Blinky"); + this.changeSauce("Geister/Blinky"); } else if (type == 2) { - this.changeSauce("Inky"); + this.changeSauce("Geister/Inky"); } else if (type == 3) { - this.changeSauce("Clyde"); + this.changeSauce("Geister/Clyde"); } else if (type == 1) { - this.changeSauce("Pinky"); + this.changeSauce("Geister/Pinky"); } } diff --git a/src/Player.java b/src/Player.java index 5eaf338..e96eae9 100644 --- a/src/Player.java +++ b/src/Player.java @@ -41,7 +41,7 @@ public class Player extends Picture implements KeyListener { // extends Picture public Player() { // Erstellen des Konstruktors - super("Pacman_Right"); // Aufrufen der übergeordneten Klasse (Picture) + super("Pac-Man/Pacman_Right"); // Aufrufen der übergeordneten Klasse (Picture) } @@ -79,8 +79,6 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_up = false; pressed_down = false; - - } else { // ansonsten: // soll Pac-Man sich sobald er kann nach links bewegen @@ -117,10 +115,7 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_right = false; pressed_up = false; pressed_down = false; - - - - + } else { pressed_left = false; pressed_right = true; @@ -151,7 +146,7 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_right = false; pressed_up = false; pressed_down = false; - + } else { pressed_left = false; pressed_right = false; @@ -182,7 +177,7 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_right = false; pressed_up = false; pressed_down = false; - + } else { pressed_left = false; pressed_right = false; @@ -256,52 +251,55 @@ public class Player extends Picture implements KeyListener { // extends Picture this.movingTicks++; int aniFrames; aniFrames = ((this.movingTicks + 1) % 125 / 25); - + if (Dir == "Left") { if (aniFrames == 1 || aniFrames == 5) { - this.changeSauce("Pacman_Left1"); + this.changeSauce("Pac-Man/Pacman_Left1"); } else if (aniFrames == 2 || aniFrames == 4) { - this.changeSauce("Pacman_Left"); + this.changeSauce("Pac-Man/Pacman_Left"); } else if (aniFrames == 3) { - this.changeSauce("Pacman_Left3"); + this.changeSauce("Pac-Man/Pacman_Left3"); } - }if (Dir == "Right") { + } + if (Dir == "Right") { if (aniFrames == 1 || aniFrames == 5) { - this.changeSauce("Pacman_Right1"); + this.changeSauce("Pac-Man/Pacman_Right1"); } else if (aniFrames == 2 || aniFrames == 4) { - this.changeSauce("Pacman_Right"); + this.changeSauce("Pac-Man/Pacman_Right"); } else if (aniFrames == 3) { - this.changeSauce("Pacman_Right3"); + this.changeSauce("Pac-Man/Pacman_Right3"); } - }if (Dir == "Up") { + } + if (Dir == "Up") { if (aniFrames == 1 || aniFrames == 5) { - this.changeSauce("Pacman_Up1"); + this.changeSauce("Pac-Man/Pacman_Up1"); } else if (aniFrames == 2 || aniFrames == 4) { - this.changeSauce("Pacman_Up"); + this.changeSauce("Pac-Man/Pacman_Up"); } else if (aniFrames == 3) { - this.changeSauce("Pacman_Up3"); + this.changeSauce("Pac-Man/Pacman_Up3"); } - }if (Dir == "Down") { + } + if (Dir == "Down") { if (aniFrames == 1 || aniFrames == 5) { - this.changeSauce("Pacman_Down1"); + this.changeSauce("Pac-Man/Pacman_Down1"); } else if (aniFrames == 2 || aniFrames == 4) { - this.changeSauce("Pacman_Down"); + this.changeSauce("Pac-Man/Pacman_Down"); } else if (aniFrames == 3) { - this.changeSauce("Pacman_Down3"); + this.changeSauce("Pac-Man/Pacman_Down3"); }