diff --git a/Archer.class b/Archer.class index 12bfde9..f36f613 100644 Binary files a/Archer.class and b/Archer.class differ diff --git a/Archer.ctxt b/Archer.ctxt index cfc1e5b..7371f26 100644 --- a/Archer.ctxt +++ b/Archer.ctxt @@ -1,6 +1,6 @@ #BlueJ class context comment0.target=Archer -comment0.text=\r\n\ Beschreiben\ Sie\ hier\ die\ Klasse\ Archer.\r\n\ \r\n\ @author\ (Ihr\ Name)\ \r\n\ @version\ v1.1\ (02.06.2022\ 15\:10)\r\n +comment0.text=\r\n\ Beschreiben\ Sie\ hier\ die\ Klasse\ Archer.\r\n\ \r\n\ @author\ (Ihr\ Name)\ \r\n\ @version\ v1.2\ (02.06.2022\ 15\:35)\r\n comment1.params=inputplayer\ archercolor\ usedcanvas comment1.target=Archer(int,\ java.awt.Color,\ Canvas) comment2.params= diff --git a/Archer.java b/Archer.java index c2ae948..dd560ce 100644 --- a/Archer.java +++ b/Archer.java @@ -6,7 +6,7 @@ * Beschreiben Sie hier die Klasse Archer. * * @author (Ihr Name) - * @version v1.1 (02.06.2022 15:10) + * @version v1.2 (02.06.2022 15:35) */ public class Archer extends Game { @@ -35,7 +35,6 @@ public void draw() screenbg.setForegroundColor(color); screenbg.setVisible(true); // the head - //screenbg.fillCircle(910,640,5,5); screenbg.fillCircle(xPosition+8,yPosition,14); // the body top to bottom screenbg.drawLine(xPosition+15,yPosition+13,xPosition+15,yPosition+53); @@ -52,7 +51,6 @@ public void eraseArcher() screenbg.eraseCircle(xPosition+8,yPosition,14); screenbg.setForegroundColor(super.bgColor); //da keine Methode, um die Linien zu entfernen existiert, weiß machen // the head - //screenbg.fillCircle(910,640,5,5); screenbg.fillCircle(xPosition+8,yPosition,14); // the body top to bottom screenbg.drawLine(xPosition+15,yPosition+13,xPosition+15,yPosition+53); diff --git a/Arrow.class b/Arrow.class index 21d0f14..6a34046 100644 Binary files a/Arrow.class and b/Arrow.class differ diff --git a/Arrow.ctxt b/Arrow.ctxt index 77f82de..76500d0 100644 --- a/Arrow.ctxt +++ b/Arrow.ctxt @@ -1,6 +1,6 @@ #BlueJ class context comment0.target=Arrow -comment0.text=\r\n\ Arrow\r\n\ \r\n\r\n\ \r\n\ @author\ CS,\ SVC,\ JR\ \r\n\ @version\ v1.1\ (02.06.2022\ 15\:10)\r\n +comment0.text=\r\n\ Arrow\r\n\ \r\n\r\n\ \r\n\ @author\ CS,\ SVC,\ JR\ \r\n\ @version\ v1.2\ (02.06.2022\ 15\:35)\r\n comment1.params=inputcolor\ usedcanvas comment1.target=Arrow(java.awt.Color,\ Canvas) comment1.text=\r\n\ Constructor\ for\ instances\ of\ Arrow\r\n\r\n\ @param\ xPos\ \ \ \ \ \ \ \ x-coordinate\ of\ the\ arrow\r\n\ @param\ yPos\ \ \ \ \ \ \ \ y-coordinate\ of\ the\ arrow\r\n\ @param\ ballcolor\ \ \ color\ of\ the\ arrow\r\n\ @param\ usedcanvas\ \ canvas\ where\ to\ plot\ the\ arrow\r\n diff --git a/Arrow.java b/Arrow.java index 609d8bf..aad29c4 100644 --- a/Arrow.java +++ b/Arrow.java @@ -9,7 +9,7 @@ * * * @author CS, SVC, JR - * @version v1.1 (02.06.2022 15:10) + * @version v1.2 (02.06.2022 15:35) */ public class Arrow extends Game @@ -37,7 +37,7 @@ public Arrow(Color inputcolor, Canvas usedcanvas) xPosition = super.arrowXpos; yPosition = super.arrowYpos; screenbg = usedcanvas; - localcolor = inputcolor; + localcolor = inputcolor; } /** diff --git a/CanvasBG.class b/CanvasBG.class index 8269205..deb0aad 100644 Binary files a/CanvasBG.class and b/CanvasBG.class differ diff --git a/CanvasBG.ctxt b/CanvasBG.ctxt index 4da7738..4f9e15a 100644 --- a/CanvasBG.ctxt +++ b/CanvasBG.ctxt @@ -1,6 +1,6 @@ #BlueJ class context comment0.target=CanvasBG -comment0.text=\r\n\ Startet\ Canvas\r\n\ {@code\ Canvas}\r\n\ \r\n\ @author\ CS,\ SVC,\ JR\ \r\n\ @version\ v1.1\ (02.06.2022\ 15\:10)\r\n +comment0.text=\r\n\ Startet\ Canvas\r\n\ {@code\ Canvas}\r\n\ \r\n\ @author\ CS,\ SVC,\ JR\ \r\n\ @version\ v1.2\ (02.06.2022\ 15\:35)\r\n comment1.params=inputa\ starttarget comment1.target=CanvasBG(short,\ int) comment2.params= diff --git a/CanvasBG.java b/CanvasBG.java index ab5ed00..6ad3bf1 100644 --- a/CanvasBG.java +++ b/CanvasBG.java @@ -6,7 +6,7 @@ * {@code Canvas} * * @author CS, SVC, JR - * @version v1.1 (02.06.2022 15:10) + * @version v1.2 (02.06.2022 15:35) */ public class CanvasBG extends Game { diff --git a/Game.class b/Game.class index f7cfcc7..42445d8 100644 Binary files a/Game.class and b/Game.class differ diff --git a/Game.ctxt b/Game.ctxt index c6fe93b..2f1bccf 100644 --- a/Game.ctxt +++ b/Game.ctxt @@ -1,6 +1,6 @@ #BlueJ class context comment0.target=Game -comment0.text=\r\n\ Terminal\ soll\ mit\ der\ Main\ Methode\ ein\ neues\ Terminal\ starten.\ Von\ dort\ aus\ kann\ der\ Anwender\r\n\ das\ Spiel\ bedienen.\ Dazu\ werden\ Eingaben\ gelesen\ und\ ausgewertet.\ \r\n\ M\u00F6gliche\ Anweisungen\ sind\:\ \r\n\ \r\n\ s\ \=\ Spielbeginn\r\n\ n\ \=\ Spielerwechsel\r\n\ h\ \=\ Hilfe\ inkl.\ Spielregeln\r\n\ e\ \=\ Punktestandausgabe\ und\ das\ Spiel\ wird\ beendet\r\n\ Strg\ +\ w\ \=\ Konsole\ schlie\u00DFen\r\n\ \r\n\ @author\ JR,\ CS,\ SVC\r\n\ @version\ v1.1\ (02.06.2022\ 15\:10)\r\n +comment0.text=\r\n\ \r\n\ @author\ JR,\ CS,\ SVC\r\n\ @version\ v1.2\ (02.06.2022\ 15\:35)\r\n comment1.params=args comment1.target=void\ main(java.lang.String[]) comment2.params= diff --git a/Game.java b/Game.java index 3effb17..2757ecf 100644 --- a/Game.java +++ b/Game.java @@ -1,23 +1,14 @@ import java.awt.Color; /** - * Terminal soll mit der Main Methode ein neues Terminal starten. Von dort aus kann der Anwender - * das Spiel bedienen. Dazu werden Eingaben gelesen und ausgewertet. - * Mögliche Anweisungen sind: - * - * s = Spielbeginn - * n = Spielerwechsel - * h = Hilfe inkl. Spielregeln - * e = Punktestandausgabe und das Spiel wird beendet - * Strg + w = Konsole schließen * * @author JR, CS, SVC - * @version v1.1 (02.06.2022 15:10) + * @version v1.2 (02.06.2022 15:35) */ public class Game { private Terminal terminal; //Global terminal - protected static final int canvasHeight = 709; //Height of the canvas. Default: 700 + protected static final int canvasHeight = 700; //Height of the canvas. Default: 700 protected static final int canvasWidth = 1000; //Width of the canvas. Default: 1000 protected static final int wallStart = 100; //Start of the wall. Default: 100 protected static final int wallThickness = 20; //Thickness of the wall. Default: 20 diff --git a/Points.ctxt b/Points.ctxt index 4b12b7d..863b058 100644 --- a/Points.ctxt +++ b/Points.ctxt @@ -1,6 +1,6 @@ #BlueJ class context comment0.target=Points -comment0.text=\r\n\ Beschreiben\ Sie\ hier\ die\ Klasse\ Points.\r\n\ \r\n\ @author\ (Ihr\ Name)\ \r\n\ @version\ v1.1\ (02.06.2022\ 15\:10)\r\n +comment0.text=\r\n\ Beschreiben\ Sie\ hier\ die\ Klasse\ Points.\r\n\ \r\n\ @author\ (Ihr\ Name)\ \r\n\ @version\ v1.2\ (02.06.2022\ 15\:35)\r\n comment1.params=playerno\ playerscore\ usedcanvas comment1.target=Points(int,\ int,\ Canvas) comment1.text=\r\n\ Konstruktor\ f\u00FCr\ Objekte\ der\ Klasse\ Points\r\n diff --git a/Points.java b/Points.java index c132a29..79a8127 100644 --- a/Points.java +++ b/Points.java @@ -4,7 +4,7 @@ * Beschreiben Sie hier die Klasse Points. * * @author (Ihr Name) - * @version v1.1 (02.06.2022 15:10) + * @version v1.2 (02.06.2022 15:35) */ public class Points extends Game { diff --git a/Terminal.class b/Terminal.class index c37b317..3a9cfc7 100644 Binary files a/Terminal.class and b/Terminal.class differ diff --git a/Terminal.ctxt b/Terminal.ctxt index 11fde18..53bc9da 100644 --- a/Terminal.ctxt +++ b/Terminal.ctxt @@ -1,6 +1,6 @@ #BlueJ class context comment0.target=Terminal -comment0.text=\r\n\ \r\n\ Die\ Klasse\ game\ beinhaltet\ die\ wichtige\ Funktion,\ das\ Spielfeld\ zu\ erstellen.\r\n\ \r\n\ @author\ JR,\ CS,\ SVC\r\n\ @version\ v1.1\ (02.06.2022\ 15\:10)\r\n +comment0.text=\r\n\ \r\n\ Die\ Klasse\ game\ beinhaltet\ die\ wichtige\ Funktion,\ das\ Spielfeld\ zu\ erstellen.\r\n\ \r\n\ @author\ JR,\ CS,\ SVC\r\n\ @version\ v1.2\ (02.06.2022\ 15\:35)\r\n comment1.params= comment1.target=void\ newGame() comment10.params= diff --git a/Terminal.java b/Terminal.java index 0c36016..e72d8b3 100644 --- a/Terminal.java +++ b/Terminal.java @@ -7,7 +7,7 @@ * Die Klasse game beinhaltet die wichtige Funktion, das Spielfeld zu erstellen. * * @author JR, CS, SVC - * @version v1.1 (02.06.2022 15:10) + * @version v1.2 (02.06.2022 15:35) */ public class Terminal extends Game { @@ -35,7 +35,8 @@ else if (input.equals("n")) { turn(); } else if (input.equals("e")) { - noInput = false; + noInput = false; + System.out.println("Game over."); returnPoints(); System.exit(0); } @@ -61,7 +62,8 @@ else if (input.equals("joe")) { public void inputForDartboard() { //ask for a System.out.println("Please enter a value for a [between 1 & " - + (super.canvasHeight-super.wallStart)/9+"]. Hint: "+((super.canvasHeight-super.wallStart)/30)+" is a good value"); + + (super.canvasHeight-super.wallStart)/9+"]. Hint: " + +((super.canvasHeight-super.wallStart)/30)+" is a good value."); boolean aOK = false; while(!aOK) { Scanner inputDimensions = new Scanner(System.in); @@ -78,7 +80,8 @@ public void inputForDartboard() { //ask for b System.out.println("Please enter a value for b [between "+(super.wallStart+(4*ea)+ahalbe) - +" & "+(super.canvasHeight-(4*ea)-ahalbe)+"]. Hint: "+((super.canvasHeight-super.wallStart)/2+super.wallStart)+" is a good value"); + +" & "+(super.canvasHeight-(4*ea)-ahalbe)+"]. Hint: " + +((super.canvasHeight-super.wallStart)/2+super.wallStart)+" is a good value."); boolean bOK = false; while(!bOK) { Scanner inputDimensions = new Scanner(System.in); @@ -100,15 +103,15 @@ public void inputForDartboard() { * Methode zur Ausgabe eines Error bezüglich der Oberfläche */ public void errorValue() { - System.out.println ("ERROR. Please enter a valid value. The limits can be seen above."); + System.out.println ("ERROR. Please enter a valid value. The limits can be seen above. You may try again."); } /** * Methode zur Ausgabe eines Willkommen-Textes */ public void welcomeText() { - System.out.println("Welcome to 2D-Darts" + "\n\n" + "Before playing, here are the instructions:" +"\n"); - System.out.println("- The red area (bullseye) gives 50 points" + "\n" + "- green (bull) gives 25 points" + "\n" + "- black gives 10 points" + "\n" + "- Everything else 0 points"); + System.out.println("Welcome to 2Darts" + "\n\n" + "Before playing, here is the overview:" +"\n"); + System.out.println("- The red area (bullseye) gives 50 points" + "\n" + "- Green (bull) gives 25 points" + "\n" + "- Black gives 10 points" + "\n" + "- Everything else 0 points"); howTo(); } @@ -158,7 +161,7 @@ else if(super.currentPlayer == 2) { } public void turn() { - System.out.println("It's player "+ super.currentPlayer +"'s turn."); + System.out.println("It's player "+ super.currentPlayer +"'s turn."); int score = screenbg.shootArrow(); @@ -170,11 +173,11 @@ public void turn() { } if(score == 50) { - System.out.println("BULLSEYE! Player "+ super.currentPlayer +" won "+ score + " Points!"); + System.out.println("BULLSEYE! Player "+ super.currentPlayer +" got "+ score + " Points! :)"); } else if(score == 0) { - System.out.println("Player "+ super.currentPlayer +" missed."); + System.out.println("Player "+ super.currentPlayer +" missed. :("); } else { - System.out.println("Player "+ super.currentPlayer +" won "+ score + " Points."); + System.out.println("Player "+ super.currentPlayer +" got "+ score + " Points."); } screenbg.printScore(super.scorePlayer1, super.scorePlayer2); @@ -189,9 +192,11 @@ public void returnPoints() System.out.println("Player 1 wins with " + super.scorePlayer1 + " points. Player 2 has " + super.scorePlayer2 + " points."); } else if(super.scorePlayer2 > super.scorePlayer1) { System.out.println("Player 2 wins with " + super.scorePlayer2 + " points. Player 1 has " + super.scorePlayer1 + " points."); + } else if((super.scorePlayer1 == 0) && (super.scorePlayer1 == 0)) { + System.out.println("Did you even play? Both players have " + super.scorePlayer1 + " points."); } else if(super.scorePlayer1 == super.scorePlayer2) { System.out.println("It's a tie! Both players have " + super.scorePlayer1 + " points."); } - System.out.println("Press Ctrl+W to exit this window."); + System.out.println("Press Ctrl+W to close this window."); } } diff --git a/package.bluej b/package.bluej index cc249b5..bc76610 100644 --- a/package.bluej +++ b/package.bluej @@ -26,10 +26,10 @@ dependency8.type=UsesDependency dependency9.from=Game dependency9.to=Terminal dependency9.type=UsesDependency -editor.fx.0.height=745 -editor.fx.0.width=698 -editor.fx.0.x=2209 -editor.fx.0.y=0 +editor.fx.0.height=737 +editor.fx.0.width=814 +editor.fx.0.x=360 +editor.fx.0.y=28 objectbench.height=136 objectbench.width=1336 package.divider.horizontal=0.5850032320620556