From eb8bb01e1720c0c48b59384f8a515bbfe45bdf69 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 8 Jun 2020 17:07:17 +0200 Subject: [PATCH] =?UTF-8?q?animationen=20f=C3=BCr=20pacman?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Maps/Flocke.txt | 27 +++++++++++++ assets/Pacman_Down1.png | Bin 0 -> 257 bytes assets/Pacman_Down3.png | Bin 0 -> 227 bytes assets/Pacman_Left1.png | Bin 0 -> 255 bytes assets/Pacman_Left3.png | Bin 0 -> 225 bytes assets/Pacman_Right1.png | Bin 0 -> 250 bytes assets/Pacman_Right3.png | Bin 0 -> 226 bytes assets/Pacman_Up1.png | Bin 0 -> 257 bytes assets/Pacman_Up3.png | Bin 0 -> 230 bytes assets/Pacman_full.png | Bin 0 -> 227 bytes assets/feared.png | Bin 505 -> 517 bytes bin/Game.class | Bin 9481 -> 9481 bytes bin/Player.class | Bin 3510 -> 4253 bytes src/Game.java | 3 +- src/Player.java | 79 +++++++++++++++++++++++++++++++++++---- 15 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 assets/Maps/Flocke.txt create mode 100644 assets/Pacman_Down1.png create mode 100644 assets/Pacman_Down3.png create mode 100644 assets/Pacman_Left1.png create mode 100644 assets/Pacman_Left3.png create mode 100644 assets/Pacman_Right1.png create mode 100644 assets/Pacman_Right3.png create mode 100644 assets/Pacman_Up1.png create mode 100644 assets/Pacman_Up3.png create mode 100644 assets/Pacman_full.png diff --git a/assets/Maps/Flocke.txt b/assets/Maps/Flocke.txt new file mode 100644 index 0000000..ff1b231 --- /dev/null +++ b/assets/Maps/Flocke.txt @@ -0,0 +1,27 @@ +########################### +############# ############# +############ ############ +########### # ########### +####0 ## ### ## 1#### +#### ## ### # ### ## #### +#### ## #.## ##.# ## #### +#### ### ### #### +####### # #,# #,# # ####### +######. ### ### .###### +#### #### ## ## #### #### +### ##,# #,## ### +## # #### #.# #### # ## +#L ### # ### R# +## # #### #P# #### # ## +### ##,# #,## ### +#### #### ## ## #### #### +######. ### ### .###### +####### # #,# #,# # ####### +#### ### ### #### +#### ## #.## ##.# ## #### +#### ## ### # ### ## #### +####2 ## ### ## 3#### +########### # ########### +############ ############ +############# ############# +########################### \ No newline at end of file diff --git a/assets/Pacman_Down1.png b/assets/Pacman_Down1.png new file mode 100644 index 0000000000000000000000000000000000000000..10f3cbf4b2df2daea79ec84e0ca2093959727609 GIT binary patch literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^B0wz6!3HEJ^yqE{QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XBj({-ZRBb+Kpx`u57sn6_|D#j9`5F{>SXX-Q?f-uNRc%bT zqn&8fzs|`51|QmvF*I~|J-PGaKw7 zqb)Pha*gue_GSjT*A=BLFGc^UTw%8;w$?~h6b<$G?Bo|P;nblR1LN&qLJ|dvGFwfJ z*tdt-$1k&GztbNree##=m*YHtn7J8*mw4TEyi*i8^?522(1i@1u6{1-oD!M<8ChF# literal 0 HcmV?d00001 diff --git a/assets/Pacman_Down3.png b/assets/Pacman_Down3.png new file mode 100644 index 0000000000000000000000000000000000000000..dcbf6c5b7fde689b82db6632e60a91ddac420db6 GIT binary patch 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%}SAcF{@O1TaS?83{1OSHVPc8re literal 0 HcmV?d00001 diff --git a/assets/Pacman_Left1.png b/assets/Pacman_Left1.png new file mode 100644 index 0000000000000000000000000000000000000000..d8def924811ec43a0fbb6acc4a7a241e11d3fb73 GIT binary patch literal 255 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv-!3HGrL)l7z6k~CayA#8@b22Z19F}xPUq=Rp zjs4tz5?O(K&H|6fVg?4jBOuH;Rhv&5C^*H_#WBRff9+*Mp%w+6*2JXOwR`H{)~>mz zz|<)4tg(La?#DH0hx97n%L-cVTXt^mkATt`k@vGy(iBU%r1mu|T+hWbd8ybz-MITb zwI$kY6C}1XY?Cl&wmUiZYNPcP_1{eDTMYRaj!RsSVE&etykC}q<6~YaPivB{8S_!$ y={J~;q~-`dGGhB<;e6`zulmcgHvJBIp7(~|&6f9A)^DKu7(8A5T-G@yGywqU##uW6 literal 0 HcmV?d00001 diff --git a/assets/Pacman_Left3.png b/assets/Pacman_Left3.png new file mode 100644 index 0000000000000000000000000000000000000000..5377f77eb552f06fc64848167903b5db52acf3a9 GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv-!3HGrL)l7z6k~CayA#8@b22Z19F}xPUq=Rp zjs4tz5?O(K&H|6fVg?4jBOuH;Rhv&5C|Ks{;uvD#|8|NY-vI><*NI!dzx@0B-g4um zf{R^~x>5^XM4Pb1*)^*uHT5MM%eDUXDSBOT%1x+O(bckck@RA_(|Z;*y*iv3xbWrr zw-p Rr~k literal 0 HcmV?d00001 diff --git a/assets/Pacman_Right1.png b/assets/Pacman_Right1.png new file mode 100644 index 0000000000000000000000000000000000000000..7c8905f6f6317879269c5294caca22b949012507 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv-!3HGrL)l7z6k~CayA#8@b22Z19F}xPUq=Rp zjs4tz5?O(K&H|6fVg?4jBOuH;Rhv&5DA@1m;uvD#zxIkDUxNZqYvSowwR`@*shzW0 zUw|=pA?rU^;gi#EF(y6peS7C?|8dusZ+(wNo!HLA`*P-IhZPp_$#EQ=lYN~ulDHMV z+@Gn+=ycF_DwE><6kd*-8~Iv}l`Ts-&a?Zg?={BeRPj*Wf}C_N3B&g#9t@vTxDWg? sS9eenDtpE{|8qmZNxhxhl#ku!RbOGR&~n-{1?V&ePgg&ebxsLQ04Lg4y8r+H literal 0 HcmV?d00001 diff --git a/assets/Pacman_Right3.png b/assets/Pacman_Right3.png new file mode 100644 index 0000000000000000000000000000000000000000..697f6b92a7e8f5e2c60311947e7e1b88c8aebe0f GIT binary patch literal 226 zcmeAS@N?(olHy`uVBq!ia0vp^!ayv-!3HGrL)l7z6k~CayA#8@b22Z19F}xPUq=Rp zjs4tz5?O(K&H|6fVg?4jBOuH;Rhv&5C|K_4;uvD#pZw?le|u)Xf-dRpOKyg{X>jvx zkZwCKP|}d1Aw0#6A&7^GQRVB3wuxB+JPuzK_js;z^k8^oq$R<^G$YZCF=5fP)ea4( z^cE{g7`7#z-0*}+s$#O&I_DidLClT60{42ZYYeCbDqPj*@oHs6jNn{1`ISV`@iy0XBj({-ZRBb+Kpx`u57sn6_|E*IT`5F{>SXR3K?f<|3RlSX} zwva#ur>ok{FW z-IsX2Ek7-l85VqQgL_n@_Wy*Pvk#h?K4Uvt<;-#GKJPA|3mH6J{an^LB{Ts5VTV^@ literal 0 HcmV?d00001 diff --git a/assets/Pacman_Up3.png b/assets/Pacman_Up3.png new file mode 100644 index 0000000000000000000000000000000000000000..8bec83d0b706ac5c497cceab4d8229816482c32d GIT binary patch literal 230 zcmeAS@N?(olHy`uVBq!ia0vp^B0wz6!3HEJ^yqE{QjEnx?oJHr&dIz4a#+$GeH|GX zHuiJ>Nn{1`ISV`@iy0XBj({-ZRBb+KpkTG9i(`m|fAXLI|LvK%EROc7IWWwqO>Nn9 zpn=oNnPFvHBf~7Ymc}O%Y|I{2iflni5Nn{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%}SAcF{@O1TaS?83{1OSHVPc8re literal 0 HcmV?d00001 diff --git a/assets/feared.png b/assets/feared.png index c68d520bd83f827d3bd62c84068fce830e610372..de1074d6ce364da12e49ff656ca1a84bd2755d20 100644 GIT binary patch delta 441 zcmV;q0Y?7$1BC>TR)3mFL_t(IPpwotPQySDT~ly@KtV}^k`jdzKu-gl0SSqQf;KLY z5Fjc_jzFmBIRTVF0d$0dAX9+Ihs1;5cxN-awxvk$q|wf2J^N;M))5hz|HM=YR~m+H zyRo%$(0d$N)x(TkJs<(rXfEdU<{>*cNPw8^)2L)vwi(b&n}72$A7;%QNT{V*CxVz- zD>HMS*2NaVUL9kGV1tu{m7KbElH1ouKC3dwH?CwPTRdRZ;bOxo$)|~yPTfUFZ#7)` znr=v+Ed?o)l7#5_iD)<^>b!WRd&xH2>LZJ@t1d0?JyQMfP5g#lKR7lXrPSEDr}h0i z7jwz52Ey1q?|;xjWCdn(IQa3ho!|mV-g6_h9p`YG%sK)K0v@C zg*FyeVrea?m9~;r&|VP#Gzux?NEG!v^v0XropZCd2M79t&Cbp3ee>x$ zGc4dkL{o>pULCENAb3TqJ82$%nf@|C!bQi3vY?E`c_JA;R*&_dARxNCC5j@Vr$<^p zOuxaXDUf@bduPu$==SkZt)N-2>SUPgt~QJKo6y{TL49I?<<5e7HNrpAL++2;qnloY z-tHU*Z6jup^nVNe{RS>~v>2lVS*&%U9l9>xKVuVFj3vzrL&S0RW(^&R3Jffq9!m6v z*6Fx;&;<9u`9=to%Sg;9cz5Zw@%66=EG*Y56=Yn8Hg>VRdno+bp-mx&Qpo4bXCf8k zQ&vF^Ea-0CSIjGzoUXb?=25{po_%>cm)WxX$$61fmL{AaYuTY&Xvm?w6l776yv_kX XZ}JVs7=<*X00000NkvXXu0mjf=pW8H diff --git a/bin/Game.class b/bin/Game.class index 5844c8f794ed958003f394d1ddfc0558ec1edbb4..c39be5587cb69547e98cff7d65adcb10a47050f3 100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RfP%EBBop>(t zi_j?EL6a!KK~axpaR{G^4jdN8(IR@#D*DhS`tiBp;D|8=M~zIh8`&XzVXVfNMg_hy z4xrO$#c|^TzBQxKWhSEAoQM-<4o;dO^q8CRy;+9SW-ZQ`9XM*a)ioe zw3^QtwUi^(v%E$X@LKgUW7X>%rNX>UZRcpUhu5n*-Vjm^7*;K4R-H^x-5jS*F;Vq% zyhYw@#c_g_%3G`)-fAsil2yQo)?1up6?3vx&fBae-fn%(Wa}iSSm!y_8fJ<;g466# zOtlkuhn>dhb{6lnALiY5koVYyOt(vUuid~Ib{Frr&oMO1zRcP7-^_GO&T(RxoN z$>4)dkU35f=Q^7>&nacD^C9z`dgeQaINxdK0;iLYIK6z-xxmMq0WNf-xXASwbmO?h zP2^H{8XtGl`J_9O`R*K!b90&CF6Q&@G8VX7xXS&EFSs2czUcPyCHEo=-CtScjpi%f zeSFo+;hP@#c`>`zX$8xiu#4Y}GzU$B8d;VN* z^%t_#537a=!1^@&o@!#9iFuhx+)D|1+!n0q*sOxKBs1 zTH9Q&V_BoevQAH6y-sF>PGO@?W0Owj0sR0E>a2+KA}z?n`U$q^XV|LOuuT_6{AQ$; z@TlI(c3sJ1x{4k8V{GG70OJt{=o&8P3Pe_G-!w1E>xRMaVDSVz_Jmi&FEV;z^K|%B H{G|T@6l3~c diff --git a/bin/Player.class b/bin/Player.class index 56c9ae4972f3b46b05750493d0c09f33c2d20359..f259955c379d98ad2ddd26cba69f8e1ca482034f 100644 GIT binary patch literal 4253 zcmb_f3vg7`8UD__n|o83#YVY3@Hy9v<( zDj<*eClv=&N&rB*w&?Tn7?Ogm1e9b0YfSn0z~XUa?~THEj3yV+z(t5!Ri zob#Xm{QrOc_kZ{GPcFR-pa@Ufpa@ti!v1zWW`jk*RuKxs6EWQetH8KMf2+UH-xe>_ zTlGl1aFyO(7HWy>5j`g0YSCjMf4D}EwS=OP>XKywqEukm(rBb5?vKQ4{NaS2@x$8p zr_B77?-l{e_KIi=X;u(yH^7W=s8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w_5uA(sg)7ftmEW1cYJXvQ1{MCr+V3-1^CE>3ALY25VE}$O z=}rMFe=$4g8r+1n<@6N;T$v4!8>-cYdC@bb`2nuB1KjyP z2dHqeK(Y~RoI_AyYa_Uj`ClMt1<0XIIsKmy9GD*E^pMw2nTb&`#(N-znAnRk zv7d+jB;w*A65=5w#bZc`ConFKU_ugiQ0eo3Lh$rM>Ov^{`qv2q5gHu`+X0-KqUfYOoXq)j(tpP7++wh{+iql#bzNPizjMk5g7Q$I=80WN6yrjkP zZEXTCYy0quHi=iYgZQp>$`10{;7OW2Wfe8ZvsfME!x$nZQO0Z!lhTC9@q}}h_s%Tu zVvZ+&nB&RUay*!i<`?$oJuXAGM_=AA(0uN3h$z7x+w)`~ms?HD?hy zi}>6{H_=2o`A0+|4wl%!xTOPAY&ksO~4*gqSrUW=%|7 z*~Cw;U}6u_c2L60E0UKTri#6Lj-r7F!j5V9O7o|tvE09tHyAk;r3Xg_GiW@CQm)#j zQDn)N%$E;PPGRGrnPP9+Hq^DiP#|lFiUHeD#{xq+IX|Sxz@ZsAL%*!HXTz)a#V>i0 z|B4UmH`w~WMm63<9e#rVev2J=i$}oQh~OREgWusW-o>N1Xl0?4HW=S*BB!tycUy^` zqOO}5sN!+Mx!RXk=F6jGA3kGehbfoVZl9GM-S2zAO2Z;6#(ZlTm_3}b&y7FQ%RljX o@n^nW{=ygTd-J^T&3fUR^}@#kOErS>!U4IcfZzTsX^DIP0q=+IAOHXW diff --git a/src/Game.java b/src/Game.java index b29831e..2eca0a9 100644 --- a/src/Game.java +++ b/src/Game.java @@ -153,7 +153,8 @@ public class Game { // ----------------------------------------------------------------------------------------------------------------------------------------------------- while (true) { // Hauptschleife - + + for (int i = 0; i < ghosts.length; i++) { if (ghosts[i].getIsDead()) { if (ghosts[i].getDeathTimer() != 0) { diff --git a/src/Player.java b/src/Player.java index 113b02e..5eaf338 100644 --- a/src/Player.java +++ b/src/Player.java @@ -35,7 +35,9 @@ public class Player extends Picture implements KeyListener { // extends Picture public boolean pressed_down; public boolean hui; // Boolean zur Abfrage, ob gerade ein Brick im Weg ist, um den aktuellen - // Richtungsbefehl durchzuführen. + + private int movingTicks; + // Richtungsbefehl durchzuführen. public Player() { // Erstellen des Konstruktors @@ -77,8 +79,8 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_up = false; pressed_down = false; - // und Pac-Man schaut jetzt nach links - this.changeSauce("Pacman_Left"); + + } else { // ansonsten: // soll Pac-Man sich sobald er kann nach links bewegen @@ -115,7 +117,10 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_right = false; pressed_up = false; pressed_down = false; - this.changeSauce("Pacman_Right"); + + + + } else { pressed_left = false; pressed_right = true; @@ -146,7 +151,7 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_right = false; pressed_up = false; pressed_down = false; - this.changeSauce("Pacman_Up"); + } else { pressed_left = false; pressed_right = false; @@ -177,7 +182,7 @@ public class Player extends Picture implements KeyListener { // extends Picture pressed_right = false; pressed_up = false; pressed_down = false; - this.changeSauce("Pacman_Down"); + } else { pressed_left = false; pressed_right = false; @@ -216,15 +221,19 @@ public class Player extends Picture implements KeyListener { // extends Picture if (coordinate == 'x') { // Auslesen der 'x' - Koordinate: if (left && dt != 0) { xPos -= speed * dt; + animate("Left"); } else if (right && dt != 0) { xPos += speed * dt; + animate("Right"); } return (int) xPos; } else if (coordinate == 'y') { // Auslesen der 'y' - Koordinate: if (down && dt != 0) { yPos += speed * dt; + animate("Down"); } else if (up && dt != 0) { yPos -= speed * dt; + animate("Up"); } return (int) yPos; } else { @@ -243,4 +252,60 @@ public class Player extends Picture implements KeyListener { // extends Picture } -} \ No newline at end of file + private void animate(String Dir) { + this.movingTicks++; + int aniFrames; + aniFrames = ((this.movingTicks + 1) % 125 / 25); + + if (Dir == "Left") { + if (aniFrames == 1 || aniFrames == 5) { + this.changeSauce("Pacman_Left1"); + + } else if (aniFrames == 2 || aniFrames == 4) { + this.changeSauce("Pacman_Left"); + + } else if (aniFrames == 3) { + this.changeSauce("Pacman_Left3"); + + } + + }if (Dir == "Right") { + if (aniFrames == 1 || aniFrames == 5) { + this.changeSauce("Pacman_Right1"); + + } else if (aniFrames == 2 || aniFrames == 4) { + this.changeSauce("Pacman_Right"); + + } else if (aniFrames == 3) { + this.changeSauce("Pacman_Right3"); + + } + + }if (Dir == "Up") { + if (aniFrames == 1 || aniFrames == 5) { + this.changeSauce("Pacman_Up1"); + + } else if (aniFrames == 2 || aniFrames == 4) { + this.changeSauce("Pacman_Up"); + + } else if (aniFrames == 3) { + this.changeSauce("Pacman_Up3"); + + } + + }if (Dir == "Down") { + if (aniFrames == 1 || aniFrames == 5) { + this.changeSauce("Pacman_Down1"); + + } else if (aniFrames == 2 || aniFrames == 4) { + this.changeSauce("Pacman_Down"); + + } else if (aniFrames == 3) { + this.changeSauce("Pacman_Down3"); + + } + + } + + } +}