1
0
Fork 0

Aufgabe 3 Feedback - minor fixes

This commit is contained in:
rxbn_ 2020-01-23 18:45:36 +01:00
parent 49f431c236
commit 87048abd6f
3 changed files with 12 additions and 8 deletions

View File

@ -42,7 +42,7 @@ public class Level extends Thread implements ILevel {
/**
* Flag that shows if the level was finished
*/
private boolean levelFinished = false;
private boolean finished = false;
/**
* The paddles of the level
@ -127,7 +127,7 @@ public class Level extends Thread implements ILevel {
game.notifyObservers();
// endless loop
while (!levelFinished) {
while (!finished) {
// if ballWasStarted is true, the ball is moving
if (ballWasStarted()) {
@ -240,7 +240,7 @@ public class Level extends Thread implements ILevel {
* @param finished game state
*/
public void setFinished(boolean finished) {
this.levelFinished = finished;
this.finished = finished;
}
/**

View File

@ -136,9 +136,10 @@ public class Paddle implements IPaddle {
* @param direction The paddles new direction
*/
public void setDirection(int direction) {
// normalization not needed
// normalize to valid values
if(direction > 0) direction = 1;
if(direction < 0) direction = -1;
//if(direction > 0) direction = 1;
//if(direction < 0) direction = -1;
this.direction = direction;
}

View File

@ -112,10 +112,10 @@ public class Stone implements IStone {
* @param type The stones new type
*/
public void setType(int type) {
// type not in range
if(type > 3) { type = 0; }
setValue(type);
// set the type; no verification needed;
this.type = type;
switch(type) {
// multi-case, hacky, but dont care
case 0:
@ -128,14 +128,17 @@ public class Stone implements IStone {
case 1:
// stone type one
setColor(Color.CYAN);
setValue(1);
break;
case 2:
// stone type two
setColor(Color.WHITE);
setValue(2);
break;
case 3:
// stone type three
setColor(Color.BLUE);
setValue(3);
break;
}
}