1
0
Fork 0

Aufgabe 3.1

This commit is contained in:
rxbn_ 2019-12-17 20:38:47 +01:00
parent 9182e79f6b
commit ba286f548f
2 changed files with 9 additions and 2 deletions

View File

@ -104,7 +104,6 @@ public class Controller implements ActionListener, KeyListener {
*/ */
@Override @Override
public void keyTyped(KeyEvent e) { public void keyTyped(KeyEvent e) {
} }
/** /**
@ -114,6 +113,14 @@ public class Controller implements ActionListener, KeyListener {
*/ */
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
switch(e.getKeyCode()) {
// space bar was pressed
case KeyEvent.VK_SPACE:
// start-stop mechanism for the ball
if(!game.getLevel().ballWasStarted()) game.getLevel().startBall();
else game.getLevel().stopBall();
break;
}
} }

View File

@ -34,7 +34,7 @@ public class Level extends Thread implements ILevel {
/** /**
* Flag that shows if the ball was started * Flag that shows if the ball was started
*/ */
private boolean ballWasStarted = true; private boolean ballWasStarted = false;
/** /**
* The paddles of the level * The paddles of the level