Skip to content

Commit

Permalink
hotfile-v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jnnsrctr committed Aug 9, 2022
1 parent 8c91d00 commit cb885a9
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 40 deletions.
Binary file modified Archer.class
Binary file not shown.
2 changes: 1 addition & 1 deletion Archer.ctxt
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
4 changes: 1 addition & 3 deletions Archer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Binary file modified Arrow.class
Binary file not shown.
2 changes: 1 addition & 1 deletion Arrow.ctxt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Arrow.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -37,7 +37,7 @@ public Arrow(Color inputcolor, Canvas usedcanvas)
xPosition = super.arrowXpos;
yPosition = super.arrowYpos;
screenbg = usedcanvas;
localcolor = inputcolor;
localcolor = inputcolor;
}

/**
Expand Down
Binary file modified CanvasBG.class
Binary file not shown.
2 changes: 1 addition & 1 deletion CanvasBG.ctxt
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
2 changes: 1 addition & 1 deletion CanvasBG.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Binary file modified Game.class
Binary file not shown.
2 changes: 1 addition & 1 deletion Game.ctxt
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
13 changes: 2 additions & 11 deletions Game.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Points.ctxt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Points.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Binary file modified Terminal.class
Binary file not shown.
2 changes: 1 addition & 1 deletion Terminal.ctxt
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
29 changes: 17 additions & 12 deletions Terminal.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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();
}

Expand Down Expand Up @@ -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();

Expand All @@ -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);
Expand All @@ -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.");
}
}
8 changes: 4 additions & 4 deletions package.bluej
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb885a9

Please sign in to comment.