From 63b85260fd7ade5e495d577e1c72fb11230e025b Mon Sep 17 00:00:00 2001 From: Lenz Date: Sat, 6 Jun 2020 13:43:47 +0200 Subject: [PATCH] punkte kollision gefixt --- bin/Brick.class | Bin 450 -> 450 bytes bin/Game.class | Bin 5986 -> 5809 bytes bin/Ghost.class | Bin 1479 -> 1479 bytes bin/Main.class | Bin 558 -> 558 bytes bin/Map.class | Bin 2091 -> 2091 bytes bin/Picture.class | Bin 1415 -> 1415 bytes bin/Player.class | Bin 3510 -> 3510 bytes src/Game.java | 29 ++++++++++++++++++++++------- 8 files changed, 22 insertions(+), 7 deletions(-) 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 2c5cf7ea3b9d90083faf0d2423213d13528fc7ab..a1e5f92af3024477133c25ba0c1580d8d0950b11 100644 GIT binary patch delta 1344 zcmah}Yiv_x7=GS!`@VLqcI{B>y2>DnGLa?ql8iaTxOj^g%)lSwk2SPtwH>t^;3c7= zxR@9s*&!zKZ$>jgLbBTt`9YR=AzAiQ+2)1mHrN;&V~opgZoa4Oh)fbsPEOwQywCGK z-}jyOJp=1n9&&aqoIC}fob(pwA>&aep2ROMoI#Wzwuj@}t70i9Dp2j7;w*5~+8@mR1zrKRnt420TovcWRrE`Pyt z5SCWc==PVW+Ll%vx=HV7xD7F4CS5E3TXx>H?tW%#kz3r@{4~}st7*RE_K{_Fy9>?t z-T4)^s^{qGCv$|<c967{ocY-t z&wr45Ouu)}bG=%m1HG;I&Ca!>*Frx>2P}MQt2nGY)wK9TX#s{fZcTKc#P%CorU6#W{Te=Z$+XY=kgkynqYF4vZQ}Tr?UmW_*ruqY0Oc z7ttqaV||lOmT9aAa%N1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J4yT~_>N6Bt!Nijh!>GlR_d=oHdKJtL8FJ^ruE3A zN1XB3q}1v0g%9~e-vl>Q@>7l&Uv|Mn%+rjrRFQTPr_$Lw)7j=aALZ_U-{X@Dq$ kiVPRu6-6W#!=Q}|lFa!elUAZvI0+u*$%_V2zN23CFX{7G2BQD~ delta 17 ZcmX@keVm)))W2Q(7#J8#HgfD|1pq=?2A%)_ diff --git a/bin/Main.class b/bin/Main.class index ef3f06657c480cca5388e7e157aa4fac9de8cadb..1a833566a526260096197e0752201ee1225efe0a 100644 GIT binary patch delta 17 ZcmZ3-vW|u0)W2Q(7#J8VH*%;k0RTNr1;+pY delta 17 ZcmZ3-vW|u0)W2Q(7#J8#Hgc#j0RTNS1;PLT diff --git a/bin/Map.class b/bin/Map.class index a6770a983ea766459e6b8bb7304bfce0784f29f4..e1ba2c3a7c9c305d5690268c0a1f579978aedcc0 100644 GIT binary patch delta 17 ZcmZ22uv&oQ)W2Q(7#J8VH*zR*002Hz1>67t delta 17 ZcmZ22uv&oQ)W2Q(7#J8#HgYI)002Ha1=j!o diff --git a/bin/Picture.class b/bin/Picture.class index 3737254b48ab4d6c68bbddd077d0d3181feadfaa..f720bca0ebe0c6c5649446ce9cce8fd8400937c9 100644 GIT binary patch delta 17 YcmZqYZs+DW^>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 cc240574e246152d49547286e5edaadb8a904695..215dc9b8d26bd6ac074d424b43488618fa9d30d2 100644 GIT binary patch delta 17 Zcmdlcy-k|q)W2Q(7#J8VH*&1w1pq=B2ABW< delta 17 Zcmdlcy-k|q)W2Q(7#J8#Hgc@v1pq<-29p2) diff --git a/src/Game.java b/src/Game.java index bc43def..0da0e2e 100644 --- a/src/Game.java +++ b/src/Game.java @@ -223,7 +223,6 @@ public class Game { } - // Kollision von Pac-Man mit Bricks: for (int i = 0; i < 35; i++) { // für jeden Brick for (int j = 0; j < 35; j++) { // für jeden Brick @@ -254,13 +253,29 @@ public class Game { } } } - if ((player.getPos('x', 0) - 10) % 20 == 0 && (player.getPos('y', 0) - 10) % 20 == 0 && Map.points[conv(player.getPos('y', 0))][conv(player.getPos('x', 0))] != null) { - Map.points[conv(player.yPos)][conv(player.xPos)].setBounds(0, 0, 0, 0); - - System.out.println("" + conv(player.yPos) + " " + conv(player.xPos)); + for (int i = 0; i < 35; i++) { + for (int j = 0; j < 35; j++) { + if (Map.points[j][i] != null) { + if (player.getPos('x', 0) < Map.points[j][i].xPos + 5 + && player.getPos('x', 0) > Map.points[j][i].xPos - 5 + && player.getPos('y', 0) < Map.points[j][i].yPos + 5 + && player.getPos('y', 0) > Map.points[j][i].yPos - 5) { + Map.points[j][i].setBounds(0, 0, 0, 0); + + } + } + } } - - + + /* + * if ((player.getPos('x', 0) - 10) % 20 == 0 && (player.getPos('y', 0) - 10) % + * 20 == 0 && Map.points[conv(player.getPos('y', 0))][conv(player.getPos('x', + * 0))] != null) { Map.points[conv(player.yPos)][conv(player.xPos)].setBounds(0, + * 0, 0, 0); + * + * } + */ + player.calcDir(0); // Berechnen wo Pac-Man als nächstes hin soll for (int i = 0; i < ghosts.length; i++) {