From c3cdb120c6f746006ab5e9f772885f04bd215465 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Jun 2020 13:32:49 +0200 Subject: [PATCH] mit points aber buggy --- assets/Map.txt | 20 ++++++------- assets/point.png | Bin 0 -> 149 bytes bin/.gitignore | 1 + bin/Game.class | Bin 5697 -> 5986 bytes bin/Ghost.class | Bin 1479 -> 1479 bytes bin/Map.class | Bin 1968 -> 2091 bytes bin/Player.class | Bin 3510 -> 3510 bytes src/Game.java | 74 +++++++++++++++++++++++++++++------------------ src/Map.java | 5 +++- src/Player.java | 4 +-- src/Point.java | 24 +++++++++++++++ 11 files changed, 87 insertions(+), 41 deletions(-) create mode 100644 assets/point.png create mode 100644 bin/.gitignore create mode 100644 src/Point.java diff --git a/assets/Map.txt b/assets/Map.txt index f9a47bf..ec3ca9d 100644 --- a/assets/Map.txt +++ b/assets/Map.txt @@ -1,17 +1,17 @@ ################################### # # -# ############ ###### ########### # +# ##### ###### ###### ###### #### # # ###### # -# ############ ###### ########### # -# ############ ########### # -# ## ### # -# ############ 0123 ########### # -# ########## ###### ######### # +# ##### ###### ###### ###### #### # +# ##### ###### ###### #### # +# ##,### # +# ##### ###### ,0123, ###### #### # +# ### ###### ###### ###### ## # # # # P # # # -# ############ # ## # ########### # +# ##### ###### # ## # ###### #### # # # ## # # -# ############ ## ########### # -# ############# ############ # -# ############# #### ############ # +# ### ######## ## ######## ## # +# ##### ####### ####### #### # +# ##### ####### #### ####### #### # # # ################################### \ No newline at end of file diff --git a/assets/point.png b/assets/point.png new file mode 100644 index 0000000000000000000000000000000000000000..14a50dca5e5765fe2edaaff748b4566921cf51cc GIT binary patch literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1SFYWcSQjy#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!pq8hLV~B-+vIMKL+#hyk4R+~-mP-;0kRJM?eUS(Ws*xCJ2>Maj-HarL9;eX?D?V!zM!# zgwe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+wxcDIonPwYX)!?^DJ_X5rz|Q;4K|*TJwcx+}n7E!3g?-6=TXL`x(^ioKX%iylbK# zTryf#<87|5GCo@{i8n5?Hwb3dGpEG1;7g^)}!j1?vV4{^0HB0Hp$F=Cia82OTVhb7bqE7K1I5s{TYE@O#F&8q6W&V z{Z&q^$M3QMzn~LV?%!V~4q0v^FhpToXX%#99a#0NIsQwzgtn{|bGeyHI|8}EB_X{s>O8^Izu=J4h^~;gHFSpY_`3C^{g;j=brvs&J&x9|K+SJL z(^53MSJ+r30iJK8B{34GjWimCT5Nn_V_lRS+X1?c&P22! zjQJkUUq^ln;>l?})YAw-4;RUV4T)+!goM_O=nSLK!?k2aPq|(gAW!B@&OBVNJDE3A zVVSaibKS8^t<`-W4{fi-l?2c&MaO!eSKccxxzZ=t*bzl%B+%F55OuyijAe2*f?d6` zOaGO@{=GOqC6E4X!(3$*yHk zBZ+iq_R@0#%`~80k6lkaQ67yCkPf!25Wztkzfm;H#_XOI zJvlr#9e)s9Ke-VX$UEj-8-Iom&!z{cio<|13UjRv_xzBLwV;HpLmBJ9B-Vw1!ce7X zn5LMhR@|7b48Z+L79LPScu=XqBg#&Mlzn(yy%|raqfw(q@T9s7PpQZ8EO%ozzX)^q z)p(BI28)ly3*3hn`F(haSEH7P@Ctthukzh5jUV&+>TGh-B=;+ z!7Aa$YEgmD#0;zvPoPE2LaUgAFT{&zqf@?CEWno{6u~;tjP+tA7K=7ii4ABMo6sS; z&?)v{lg6=G%fc3I2)1gs<45gobZJx2t<_+gHVfOem$5_p5I}D>%(zCzaAZWG1~QU_*3`ckUkNIL;5Tn(d%(kUxQq?6vm=o&>4$FJ9{if5nEVQtc+fQ)_7^s#w2*H zl#GFvH)9}MXccE%7;+!QQiaSMBD3_0rJTu7=)?hi&aP=G2BQD~ diff --git a/bin/Map.class b/bin/Map.class index 791a8616b38cce62af49d017cf6043e3931971e0..a6770a983ea766459e6b8bb7304bfce0784f29f4 100644 GIT binary patch literal 2091 zcmZux-%}e^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^f z*eBf(ceawpXkR(T)s?!=3gQ)Tv!39{k+_rm4n1Y`O$YBDiS|@m8H2HoL$tp@ed|Em zF@{!R(O5%UZe0$ox%CQ07LM?{7dUr_PU72Q`+iUv_uTb?AIgFn#?ex7qk!8_`$f&YZHfw1P+kI*XY7iYU~-hQ9%!0p%=d}@;CJ3PYei^ zSF8ntq6;_0C~k{!w2Md3#3Dw-V~mPbe&4dVCvqHjxGrGKmC&Fk3131@;x2S-NZE)a zq{;*QXNV(1TabC0kcC0-CV3}N^A}pg-%u6q8Bg`~_3_VlO$7cx6n I0RiOx1y+Hj8~^|S diff --git a/bin/Player.class b/bin/Player.class index ccedcbfca8e3e4cde8d0dc4c9773bd6b461fb1e9..cc240574e246152d49547286e5edaadb8a904695 100644 GIT binary patch delta 22 dcmdlcy-j+9D+?zh0}lf)0|Nu&W 4 - int b = (int) (a - 10 )/ 20; + + private int conv(float a) { // 90.0 --> 4 + int b = (int) (a - 10) / 20; return b; } - } diff --git a/src/Map.java b/src/Map.java index 4d07946..d7872c8 100644 --- a/src/Map.java +++ b/src/Map.java @@ -7,7 +7,8 @@ import java.io.FileReader; public class Map { public static Brick bricks[][] = new Brick[35][35]; // Zweidimensionales Array für alle Bricks - // Zweidimensionale Arrays siehe + public static Point points[][] = new Point[35][35]; + // Zweidimensionale Arrays siehe // https://de.wikipedia.org/wiki/Feld_(Datentyp)#Mehrdimensional_/_in-sich-mehrdimensional BufferedReader reader; // reader zum Einlesen der Text Datei @@ -51,6 +52,8 @@ public class Map { } else if (line.charAt(j) == '3') { ghosts[3].setPos('x', 10 + 20 * j); ghosts[3].setPos('y', 10 + 20 * i); + } else if (line.charAt(j) == ' ') { + points[i][j] = new Point(10 + 20 * j, 10 + 20 * i); } } catch (Exception e) { diff --git a/src/Player.java b/src/Player.java index 2509589..6395325 100644 --- a/src/Player.java +++ b/src/Player.java @@ -10,8 +10,8 @@ public class Player extends Picture implements KeyListener { // extends Picture private static final long serialVersionUID = -4225811153447791553L; - private float xPos; // Position auf dem Frame in x-Richtung - private float yPos; // Position auf dem Frame in y-Richtung + public float xPos; // Position auf dem Frame in x-Richtung + public float yPos; // Position auf dem Frame in y-Richtung public int lives = 3; diff --git a/src/Point.java b/src/Point.java new file mode 100644 index 0000000..87f0412 --- /dev/null +++ b/src/Point.java @@ -0,0 +1,24 @@ +// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar. + +public class Point extends Picture { // Die übergeordnete Klasse ist Picture + + + + private static final long serialVersionUID = -1204077187616807301L; + + + public int xPos; // Position auf dem Frame in x-Richtung + public int yPos; // Position auf dem Frame in y-Richtung + + public Point(int newXPos, int newYPos) { // Erstellen des Konstruktors mit den Koordinaten, an denen sich der Brick + // beefinden soll. + + super("point"); // Aufrufen der übergeordneten Klasse + + // Setzen der Positionen: + xPos = newXPos; + yPos = newYPos; + + } + +}