Aufgabe 3 Feedback - minor fixes
This commit is contained in:
parent
49f431c236
commit
87048abd6f
@ -42,7 +42,7 @@ public class Level extends Thread implements ILevel {
|
|||||||
/**
|
/**
|
||||||
* Flag that shows if the level was finished
|
* Flag that shows if the level was finished
|
||||||
*/
|
*/
|
||||||
private boolean levelFinished = false;
|
private boolean finished = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The paddles of the level
|
* The paddles of the level
|
||||||
@ -127,7 +127,7 @@ public class Level extends Thread implements ILevel {
|
|||||||
game.notifyObservers();
|
game.notifyObservers();
|
||||||
|
|
||||||
// endless loop
|
// endless loop
|
||||||
while (!levelFinished) {
|
while (!finished) {
|
||||||
// if ballWasStarted is true, the ball is moving
|
// if ballWasStarted is true, the ball is moving
|
||||||
if (ballWasStarted()) {
|
if (ballWasStarted()) {
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ public class Level extends Thread implements ILevel {
|
|||||||
* @param finished game state
|
* @param finished game state
|
||||||
*/
|
*/
|
||||||
public void setFinished(boolean finished) {
|
public void setFinished(boolean finished) {
|
||||||
this.levelFinished = finished;
|
this.finished = finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,9 +136,10 @@ public class Paddle implements IPaddle {
|
|||||||
* @param direction The paddles new direction
|
* @param direction The paddles new direction
|
||||||
*/
|
*/
|
||||||
public void setDirection(int direction) {
|
public void setDirection(int direction) {
|
||||||
|
// normalization not needed
|
||||||
// normalize to valid values
|
// 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;
|
this.direction = direction;
|
||||||
}
|
}
|
||||||
|
@ -112,10 +112,10 @@ public class Stone implements IStone {
|
|||||||
* @param type The stones new type
|
* @param type The stones new type
|
||||||
*/
|
*/
|
||||||
public void setType(int type) {
|
public void setType(int type) {
|
||||||
// type not in range
|
|
||||||
if(type > 3) { type = 0; }
|
// set the type; no verification needed;
|
||||||
setValue(type);
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
// multi-case, hacky, but dont care
|
// multi-case, hacky, but dont care
|
||||||
case 0:
|
case 0:
|
||||||
@ -128,14 +128,17 @@ public class Stone implements IStone {
|
|||||||
case 1:
|
case 1:
|
||||||
// stone type one
|
// stone type one
|
||||||
setColor(Color.CYAN);
|
setColor(Color.CYAN);
|
||||||
|
setValue(1);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// stone type two
|
// stone type two
|
||||||
setColor(Color.WHITE);
|
setColor(Color.WHITE);
|
||||||
|
setValue(2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// stone type three
|
// stone type three
|
||||||
setColor(Color.BLUE);
|
setColor(Color.BLUE);
|
||||||
|
setValue(3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user