From a169f0676a241a4dfb7a565c3451ac916c5f6fd7 Mon Sep 17 00:00:00 2001 From: Lenz Date: Mon, 8 Jun 2020 14:02:07 +0200 Subject: [PATCH] =?UTF-8?q?paar=20kleine=20Sch=C3=B6nheits=C3=83derungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/BigPoint.class | Bin 462 -> 462 bytes bin/Brick.class | Bin 450 -> 450 bytes bin/Game.class | Bin 9635 -> 9635 bytes bin/Ghost.class | Bin 2784 -> 2792 bytes bin/Hintergrund.class | Bin 394 -> 394 bytes bin/Lives.class | Bin 336 -> 336 bytes bin/Main.class | Bin 1327 -> 1327 bytes bin/Map.class | Bin 2892 -> 2892 bytes bin/MapMenu.class | Bin 3039 -> 3039 bytes bin/Point.class | Bin 450 -> 450 bytes bin/Portal.class | Bin 454 -> 454 bytes src/BigPoint.java | 6 +++--- src/Brick.java | 2 +- src/Game.java | 20 ++++++++------------ src/Ghost.java | 9 +++++---- src/Hintergrund.java | 18 +++++++----------- src/Lives.java | 4 +++- src/Main.java | 5 +---- src/Map.java | 2 -- src/MapMenu.java | 7 +++---- src/Point.java | 2 +- src/Portal.java | 17 ++++++++--------- 22 files changed, 40 insertions(+), 52 deletions(-) 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 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w>2^wFx3f$>cM`J4`9yl1PTA|6lrP34HwpF2tRyQMPV#^r#!Mh?2`8#Pu=s@%Ao zQq$yHb+vr2isc7YDnF}5@{77tPOBv;KO%pqS~;VhlRs5m$_+B2*2}-@1Nl#FLDV)- z-K430&QgQK)F~YG8?HKoRwH;?pJ0LqmwH)T=FMcH zSIXty?M(8j$@5;|3h!0&y(T7mTbbhZGS%D9G;f&c-rvmdM=>+*XHwwjaHU_!RsI4B z{hP`4D;VcjGTX0Wj=!9_{xe+bH&Nubah*TFJpVMsK^oTwAvXk>+!$QKoFI?cK>=mK zEEWd$b5pREML{FC1RJ@Ec}t>;XkY}X*_BSH70{vb0Kjvk;lvo9ydiiVM=()l=HNy z993)+9%mzC%;6OeI+#-Qn8s`wv}$Xi5}a|XSOrt u-Kq8!z4mLqu*d1M-?2Bj;Nq4vb4VNxi^mZ$4AuEL70xm78LnHJllMQ{7v}E( diff --git a/bin/Ghost.class b/bin/Ghost.class index 57a4a3400d3849099d82a07233a0ee09311754c5..2280ed832afb6de27fe66446b6d2934fbf2719f4 100644 GIT binary patch delta 146 zcmaDL`a+cB)W2Q(7#J8VH*!d@G1hKYWIN5soW&qD`8|86a0-JrV+Vr|;~F5nk->{` z3xoe;e~u#75C&F;(8>Os;*;-k=rcx4=H;|yjRA_q0>#`I6DCjNylt4uz{ZfqAj^=! wpw5uR;K-1};LVWF5Xex#5YAA@kjGHWP{B~jFo~g@VGctT!y<;7$&0w`0CA`#OaK4? delta 138 zcmaDM`aqQ9)W2Q(7#J8#HgZU?F_vytWIN5soWvk8`8|6mcL#$v;~EAp#w`qflfyZR zSc4f@8A2wX<8WgPpDfC0%Nh;j#{l`_lk+(B8RI9<-&Y;ea$>7M4 o&EU5cc1_lPpjU0)LtlSK247`)`7-ax<{Ra2| delta 27 icmeBT?qcRR^>5cc1_lO`jU0)Lth@|t3<8t$7-ax<(+2ne diff --git a/bin/Lives.class b/bin/Lives.class index 73940706978e1ff0579f0cb10b8dff15e8045777..4ea4f45510b89d23fb76829c71c22f2b11f0a335 100644 GIT binary patch delta 51 zcmcb>bb*QE)W2Q(7#J8VH*%;mDsnKeF>o;m1Nl4*j6jl|L4-jRNHa2s0ZAqXaR3}L B2EYIS delta 51 zcmcb>bb*QE)W2Q(7#J8#Hgc#lDzY=MF>o*l1Nl4*j6jl|L4-jRNHa2s0ZAqXaR3_> B2DktK diff --git a/bin/Main.class b/bin/Main.class index b41e9805e8d955d241e88c4ad3ed5c2ce71b5cf3..03e66e993ac51e4fd4ec8593e424a46501e6f51b 100644 GIT binary patch delta 25 gcmZ3_wVrFkdlp_P237`X22KVU23`ia$$wak0Z=vta{vGU delta 25 gcmZ3_wVrFkdlp`4237_c22KW923`jF$$wak0Z?KEcK`qY diff --git a/bin/Map.class b/bin/Map.class index f5efc8270e2560e08d2a6ff39c7314525a5d21b9..47423ff42bbafc1084627284a21c2415bf36be68 100644 GIT binary patch delta 206 zcmWNHy-Gp>97oUZKQ!D25C_MWoHWVG)bgwEv^24z1~nWEH)>$J%oEtW1v&jPqUf5ztk})Z!r1@eS zj~#yf^N%cZa#|vj u8&oYs%~rUu43}2q%35689Wm__#XQGPV4Q*=`8?kfhth| delta 206 zcmWNHyGnuq97oUZKQw#~AP$W!HHjAzFO^!Ece9IhF%V5eX=^En5TYSy2!)({fLff| zTv`=;fF7WsF(1H>GaL?_nP=u1JI-T(4TAUyvFVZ^OpOQ~qTCbXg*XGY7_rSKJ51bT zPLdx|{Ibh}J*}`WFKMlDARigU$*M$7b@IBQpgW3srlcWdeQ>BRD*EO~bB^_wMiT~qMt6ol#!!Z!$uGE~7(*vJbNll~G4L_O RFbFfmGKe$8O`gx~006s44Qv1a delta 61 zcmcaFeqVgUc`ivGMt%lgMhON#MimBsMiYhrMt6oF#!!af$uGE~7{ewzbNll~Gw?CQ RG6*xoF^Dt7PoB^1006wI4R` Map.Left.xPos - 20 && player.getPos('y', 0) < Map.Left.yPos + 20 && player.getPos('y', 0) > Map.Left.yPos - 20) { - + if (Map.Right != null) { player.xPos = Map.Right.xPos - 20; player.yPos = Map.Right.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; - + } } } @@ -414,7 +412,7 @@ public class Game { ghosts[i].setPos('x', -100); ghosts[i].setPos('y', -100); score += 1000; - + } else { player.lives--; @@ -439,8 +437,6 @@ public class Game { fps = 1000000000 / dt; - - delay(delaytimer); // Ein delay zum Ende der Hauptschleife if (frames % 100 == 0) { diff --git a/src/Ghost.java b/src/Ghost.java index 6f5b4d0..1aa7fdf 100644 --- a/src/Ghost.java +++ b/src/Ghost.java @@ -63,7 +63,7 @@ public class Ghost extends Picture { // Die .sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10 + 80) / 20), 2) + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)); } else if (type == 2) { - HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((200 - 10 + 80) / 20), 2) + HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((200 - 10 + 80) / 20), 2) + Math.pow((((yPos - 10) / 20) + mod_y) - ((200 - 10) / 20), 2)); } else if (type == 3) { HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) @@ -71,8 +71,9 @@ public class Ghost extends Picture { // Die } } else { - HCost = 100 * (1 / (Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) - + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)))); + HCost = 100 + * (1 / (Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) + + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)))); } return (int) HCost; @@ -118,7 +119,7 @@ public class Ghost extends Picture { // Die yPos -= 1; } - return (int) yPos; // (int) + return (int) yPos; } else { return -1; } diff --git a/src/Hintergrund.java b/src/Hintergrund.java index 78fd6aa..f69fa1b 100644 --- a/src/Hintergrund.java +++ b/src/Hintergrund.java @@ -1,19 +1,15 @@ -// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar. +// Diese Klasse stellt den Hintergrun im MapMenü -public class Hintergrund extends Picture { - - +public class Hintergrund extends Picture { private static final long serialVersionUID = -8813034369041822237L; - public int xPos; - public int yPos; + public int xPos; + public int yPos; - public Hintergrund() { + public Hintergrund() { + + super("hintergrund"); - super("hintergrund"); - - } } - diff --git a/src/Lives.java b/src/Lives.java index 9d04704..2731cdf 100644 --- a/src/Lives.java +++ b/src/Lives.java @@ -1,10 +1,12 @@ - +// Diese Klasse stellt die Herzen dar. public class Lives extends Picture { private static final long serialVersionUID = -4715442447789971450L; public Lives() { + super("heart"); + } } diff --git a/src/Main.java b/src/Main.java index c5115ae..da3e939 100644 --- a/src/Main.java +++ b/src/Main.java @@ -22,13 +22,10 @@ public class Main { // 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 diff --git a/src/Map.java b/src/Map.java index 435c977..f70cf86 100644 --- a/src/Map.java +++ b/src/Map.java @@ -46,8 +46,6 @@ public class Map { reader = new BufferedReader(new FileReader("assets/Maps/" + selectedMap)); // Einlesen der .txt Datei - - for (int i = 0; i < 35; i++) { // für die ersten 35 Zeilen der Datei: String line = reader.readLine(); // Einlesen der jeweiligen Zeile for (int j = 0; j < 35; j++) { // für die ersten 35 Zeichen der jeweiligen Zeile diff --git a/src/MapMenu.java b/src/MapMenu.java index f29748e..f60bcb1 100644 --- a/src/MapMenu.java +++ b/src/MapMenu.java @@ -71,15 +71,14 @@ public class MapMenu extends JFrame { } } }); - - + bob = new JComboBox(maps); bob.setSelectedItem("Original"); panel.add(bob); bob.setBounds(50, 10, 200, 30); bob.setFont(new Font("Consolas", Font.PLAIN, 14)); - //bob.setAlignmentX(Label.CENTER); - ((JLabel)bob.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER); + // bob.setAlignmentX(Label.CENTER); + ((JLabel) bob.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER); } public String getSelectedMap() { diff --git a/src/Point.java b/src/Point.java index 016289f..504dfbb 100644 --- a/src/Point.java +++ b/src/Point.java @@ -1,4 +1,4 @@ -// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar. +// Diese Klasse stellt die einzelnen Punkte die man einsammeln kann um den Score zu vergrößern dar. public class Point extends Picture { // Die übergeordnete Klasse ist Picture diff --git a/src/Portal.java b/src/Portal.java index 59995a9..7240927 100644 --- a/src/Portal.java +++ b/src/Portal.java @@ -1,17 +1,16 @@ -// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar. +// Diese Klasse stellt die Portale auf der Map dar. -public class Portal extends Picture { - - +public class Portal extends Picture { private static final long serialVersionUID = -8813034369041822237L; - public int xPos; - public int yPos; - public Portal(int newXPos, int newYPos) { + public int xPos; + public int yPos; + + public Portal(int newXPos, int newYPos) { + + super("portal"); - super("portal"); - xPos = newXPos; yPos = newYPos;